From 0ec221cbc466430d9d9096bb503c299bcdc73383 Mon Sep 17 00:00:00 2001 From: james_sherring Date: Wed, 12 May 2004 13:52:25 +0000 Subject: [PATCH] *** empty log message *** --- st2gpx/src/COPYING | 339 --- st2gpx/src/Expat license.txt | 22 - st2gpx/src/ToDo.txt | 30 - st2gpx/src/annotations.c | 501 ----- st2gpx/src/annotations.h | 121 -- st2gpx/src/bugs.txt | 25 - st2gpx/src/build.txt | 20 - st2gpx/src/contents.c | 417 ---- st2gpx/src/contents.h | 83 - st2gpx/src/debug.c | 105 - st2gpx/src/getopt.c | 1050 --------- st2gpx/src/getopt.h | 131 -- st2gpx/src/gpx.h | 116 - st2gpx/src/history.txt | 40 - st2gpx/src/istorage license.txt | 24 - st2gpx/src/istorage-make license.txt | 24 - st2gpx/src/journey.c | 448 ---- st2gpx/src/journey.h | 387 ---- st2gpx/src/msado15.tlh | 2997 -------------------------- st2gpx/src/msado15.tli | 2095 ------------------ st2gpx/src/nannol.c | 238 -- st2gpx/src/ppinutil.c | 303 --- st2gpx/src/ppinutil.h | 134 -- st2gpx/src/properties.c | 460 ---- st2gpx/src/properties.h | 73 - st2gpx/src/pushpins.cpp | 677 ------ st2gpx/src/pushpins.h | 38 - st2gpx/src/readgpx.c | 836 ------- st2gpx/src/readmpst.c | 401 ---- st2gpx/src/st2gpx license.txt | 23 - st2gpx/src/st2gpx.c | 675 ------ st2gpx/src/st2gpx.dsw | 29 - st2gpx/src/st2gpx.h | 114 - st2gpx/src/st2gpx.sln | 21 - st2gpx/src/st2gpx.vcproj | 472 ---- st2gpx/src/writegpx.c | 446 ---- st2gpx/src/writepcx.c | 473 ---- 37 files changed, 14388 deletions(-) delete mode 100644 st2gpx/src/COPYING delete mode 100644 st2gpx/src/Expat license.txt delete mode 100644 st2gpx/src/ToDo.txt delete mode 100644 st2gpx/src/annotations.c delete mode 100644 st2gpx/src/annotations.h delete mode 100644 st2gpx/src/bugs.txt delete mode 100644 st2gpx/src/build.txt delete mode 100644 st2gpx/src/contents.c delete mode 100644 st2gpx/src/contents.h delete mode 100644 st2gpx/src/debug.c delete mode 100644 st2gpx/src/getopt.c delete mode 100644 st2gpx/src/getopt.h delete mode 100644 st2gpx/src/gpx.h delete mode 100644 st2gpx/src/history.txt delete mode 100644 st2gpx/src/istorage license.txt delete mode 100644 st2gpx/src/istorage-make license.txt delete mode 100644 st2gpx/src/journey.c delete mode 100644 st2gpx/src/journey.h delete mode 100644 st2gpx/src/msado15.tlh delete mode 100644 st2gpx/src/msado15.tli delete mode 100644 st2gpx/src/nannol.c delete mode 100644 st2gpx/src/ppinutil.c delete mode 100644 st2gpx/src/ppinutil.h delete mode 100644 st2gpx/src/properties.c delete mode 100644 st2gpx/src/properties.h delete mode 100644 st2gpx/src/pushpins.cpp delete mode 100644 st2gpx/src/pushpins.h delete mode 100644 st2gpx/src/readgpx.c delete mode 100644 st2gpx/src/readmpst.c delete mode 100644 st2gpx/src/st2gpx license.txt delete mode 100644 st2gpx/src/st2gpx.c delete mode 100644 st2gpx/src/st2gpx.dsw delete mode 100644 st2gpx/src/st2gpx.h delete mode 100644 st2gpx/src/st2gpx.sln delete mode 100644 st2gpx/src/st2gpx.vcproj delete mode 100644 st2gpx/src/writegpx.c delete mode 100644 st2gpx/src/writepcx.c diff --git a/st2gpx/src/COPYING b/st2gpx/src/COPYING deleted file mode 100644 index 4567e4480..000000000 --- a/st2gpx/src/COPYING +++ /dev/null @@ -1,339 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 59 Temple Place - Suite 330, Boston, MA 02111 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - Appendix: How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) 19yy - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111 USA - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) 19yy name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - , 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General -Public License instead of this License. diff --git a/st2gpx/src/Expat license.txt b/st2gpx/src/Expat license.txt deleted file mode 100644 index 01db7e8f5..000000000 --- a/st2gpx/src/Expat license.txt +++ /dev/null @@ -1,22 +0,0 @@ -Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd - and Clark Cooper -Copyright (c) 2001, 2002 Expat maintainers. - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/st2gpx/src/ToDo.txt b/st2gpx/src/ToDo.txt deleted file mode 100644 index 37d9669bd..000000000 --- a/st2gpx/src/ToDo.txt +++ /dev/null @@ -1,30 +0,0 @@ -To do: - - - import/export more data for pushpins, including symbol, set name(use join on read) - option to show ppin names/info on import - center and size map on annotations. - - Get point info for non-line annotations, e.g. text boxes. - import route as s&t route (Journey), i.e. not just as a line. - support unicode names (remove str2ascii) - - different colours for imported routes & tracks - export lines with arrows as routes? - put some of the ole properties into gpx file comments - - clean up main + string names. Just use stfile+path. Debug read other files - clean up gpx points/ms points/ names ms2latlon etc - clean up import structures, make like contents import? - - support drive-time zones in annotations stream? - - fix ppin import for longer renderdata - -Still to test: -* various versions, esp import -* multiple imports -* import to file with existing data -* import to empty file -* meaning of options etc for v4 files - diff --git a/st2gpx/src/annotations.c b/st2gpx/src/annotations.c deleted file mode 100644 index 2e7ef2874..000000000 --- a/st2gpx/src/annotations.c +++ /dev/null @@ -1,501 +0,0 @@ -/* - annotations.c - - Extract data from MS Streets & Trips .est, Autoroute .axe - and Mapoint .ptm files in GPX format. - - Copyright (C) 2003 James Sherring, james_sherring@yahoo.com - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111 USA - - - This app depends on istorage & istorage-make from Pabs (pabs3@zip.to) - and James Clark's Expat xml parser from http://www.libexpat.org/. - -*/ -#include -#include -#include -#include -#include -#include - -#include "gpx.h" -#include "st2gpx.h" -#include "pushpins.h" -#include "annotations.h" - -#ifdef EXPLORE -#include "explore.h" -#endif - - -// std_anotfile_header[8,9] are variable (number of annotations) -char std_annotfile_header[12] // num annots - = {0x34, 0x12, 0x00, 0x2d, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00}; - -char std_annot_linerec_header_v3[LINE_REC_LEN_V3] = -// type annot#1 , - {0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // 0x00 -//show length, -// order -//behind roads - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x08 - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x10 - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x18 -// blue 2pt - 0x12, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, // 0x20 -// show line - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // 0x28 - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x30 - 0x00}; - -char std_annot_linerec_header_v4[LINE_REC_LEN_V4] = -// type annot#1 , - {0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // 0x00 - - 0x00, 0x00, 0x00, 0x00, - -//show length, -// order -//behind roads - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -// blue 2pt - 0x12, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, -// show line - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00}; - -//struct parameters { -// Also need to include variable text length + line-points with these - -// These change with file version, so handle in code -int annot_rec_len[4]={57, 868, 124, 868}; -//int annot_head_len[4]={57, 48, 48, 48}; - -char * annot_type_name[4]={"Line", "Oval", "Textbox", "Circle"}; -//} tag_parameters; - -// constants for converting from MS Grid & Precision to latitude and longitude -// double magic1=182.044444444444; // = 2^16/360 -// double magic2=0x10000; - -/* -struct annotationbuf -{ - int annot_num; - int flags; // bit fields in first byte - int unkn1; // normally 0 - int unkn2; // ? seems to have byte fields - int text_len; - // + 2*text_len bytes of text here - int fill_color; // seems to have byte fields. First byte is fill, other bytes are strange - int line_color; - int line_thickness; // 20 times the point-size - int arrow_type; // 00=none, 01=left, 02=right, 03=both - int unkn3; - int joinflag; // 0 line does not join, 1, joins. Not sure what large balues for non-lines mean - xscale? - char unkn4; // y-scale? - int num_points; // different meaning for non-lines -}; -*/ - - -struct annot_rec * annot_rec_new() -{ - struct annot_rec * nw = (struct annot_rec *)xmalloc(sizeof(struct annot_rec)); - nw->type=-1; - nw->length=0; - nw->buf=NULL; - nw->annot_num = -1; - nw->text_length = 0; - nw->text = NULL; - nw->line_points=0; - nw->line_offset=0; - nw->is_closed_line_flag=0; - return nw; -} - -void annot_rec_delete(struct annot_rec * annot_rec) -{ - //int i; - if (annot_rec==NULL) - return; - //for(i=0; iline_points) - free(annot_rec->buf); - free(annot_rec->text); - free(annot_rec); -} - -struct annotations * annotations_new() -{ - struct annotations * nw = (struct annotations*)xmalloc(sizeof(struct annotations)); - nw->annot_list=NULL; - nw->header_buf=NULL; - nw->max_annot_num=0; - nw->num_annotations=0; - nw->read_recs_ok_flag=0; - nw->read_tail_ok_flag=0; - nw->stream_length=0; - nw->tail_buf_length=0; - nw->version=0; - return nw; -} - -void annotations_delete(struct annotations * annots) -{ - int i; - if (annots==NULL) - return; - - for (i=0; inum_annotations; i++) - annot_rec_delete(annots->annot_list[i]); - free(annots->annot_list); - free(annots->header_buf); - free(annots); -} - -struct gpxpt* gpx_get_point(char* buf) -//struct gpxpt* gpx_get_point(struct annot_line_point* bufpt) -// Convert the 12-byte location structure in annotations stream to GPS coordinates. -{ - struct gpxpt * pt = gpxpt_new(); - double x; - double y; - double z; - - if (buf==NULL) - { - printf("Trying to read line point from NULL\n"); - gpxpt_delete(pt); - return NULL; - } - - x= *(float *)(buf); - y= *(float *)(buf + 4); - z= *(float *)(buf + 8); - -// x=bufpt->x; -// y=bufpt->y; -// z=bufpt->z; - - //printf("gpx_get_point x=%f y=%f z=%f\n",x,y,z); - pt->lat = atan2(z,sqrt(pow(x,2)+ pow(y,2)))*180/M_PI; - pt->lon = atan2(y,x)*180/M_PI; - // 6378137 is earths equatorial radius in meters - // set elevation for curiosity, but dont enable it with pt->use_elevation - pt->elevation= (sqrt(pow(x,2)+ pow(y,2)+ pow(z,2))-1)*6378137; - return pt; -} - -void print_annot_rec(struct annot_rec * rec) -{ - int bit_flags = *(int*)(rec->buf + 8); - char* rec_type = NULL; - - if (rec->type<4) - rec_type =annot_type_name[rec->type]; - - printf("Got annotation id %d, of type %s, %d line points", - rec->annot_num, rec_type, rec->line_points); - if(rec->text !=NULL) - printf(" and text '%s'", rec->text); - printf("\n"); - if (opts.verbose_flag > 4) - printf("(type=%d) text length %d, bitflags %#x buf length %d\n", - rec->type, rec->text_length, bit_flags, rec->length); -} - -struct annot_rec * read_annot_rec(FILE* annot_in_file, int version) -{ - int status; - int i; - int bit_flags=0; - int text_offset; - int text_len_offset; - int line_offset; - char* rec_type=NULL; - - struct annot_rec * rec = annot_rec_new(); - int head_len = 0; - switch (version) - { - case 3: - head_len = ANNOT_REC_HEAD_LEN; - text_len_offset = ANNOT_RECOS_TEXTLEN; - text_offset = ANNOT_RECOS_TEXT; - line_offset = 57; - break; - case 4: - head_len = ANNOT_REC_HEAD_LEN+4; - text_len_offset = ANNOT_RECOS_TEXTLEN+4; - text_offset = ANNOT_RECOS_TEXT+4; - line_offset = 57 + 4; - break; - default: - // FIXME version is passed as a param, should be handled there - printf("Unrecognised record format type %d, unable to process more annotations.\n", rec->type); - return NULL; - break; - } - - // ********************** - // Read the record header - // ********************** - - rec->buf = (char*)xmalloc(head_len); - // This read can fail because I have miscalculated size or number of records - // So exit gracefully - status = readbytes(annot_in_file, rec->buf, head_len); - if (status!=head_len) - { - // should do some cleaning up here - return rec; - } - -#ifdef EXPLORE - print_f_annotation_line_header(rec->buf, head_len, version); -#endif - - rec->type = *(int*)(rec->buf+ANNOT_RECOS_TYPE); - if (rec->type > 3 ) - { - printf("Unrecognised record type %d, unable to process more annotations\n", rec->type); - printbuf(rec->buf, head_len); - return NULL; - } - - rec->annot_num = *(int*)(rec->buf+ANNOT_RECOS_ANUM); - // FIXME kludge, fit into the framework - bit_flags = *(int*)(rec->buf + 8); - rec->text_length = *(unsigned int*)(rec->buf + text_len_offset); - - // *********************** - // Read extra for the text - // *********************** - - // There can be text for lines! - // This reads the extra part of annot+headfor the text, - // but not the actual text - - rec->buf = (char*)realloc(rec->buf, head_len + 2*(rec->text_length)); - // This read can fail because I have miscalculated size or number of records - // So exit gracefully - status = readbytes(annot_in_file, rec->buf + head_len, 2*(rec->text_length)); - if (status != 2*(rec->text_length)) - { - // should do some cleaning up here - return rec; - } - head_len += 2*(rec->text_length); - line_offset += 2*(rec->text_length); - - // ****************************** - // Now we can get num line points - // ****************************** - - rec->line_points=0; - if (rec->type == ANNOT_TYPE_LINE) - rec->line_points = *(unsigned int*)(rec->buf + head_len - 4 ); - - // *************************** - // Calculate the record length - // *************************** - - rec->length = annot_rec_len[rec->type] + 2*rec->text_length + 12*rec->line_points; - if (version > 3) - rec->length += 4; - - // FIXME This is a kludge - // **** Should use c_shape_points - // c_shape_points = 33 instead of 61, so file is 12*(61-33)=336 - if (opts.st_version_num>10) - { - if ( (rec->type == ANNOT_TYPE_OVAL) || (rec->type == ANNOT_TYPE_CIRCLE) ) - { - //printf("Fudge: shortening 336 bytes from oval record length, but I dont know why.\n"); - (rec->length) -= 336; - } - } - - if (rec->type == ANNOT_TYPE_LINE) - rec->line_offset = line_offset; - - if (rec->type<4) - rec_type =annot_type_name[rec->type]; - else - rec_type=NULL; - - if (opts.verbose_flag > 4) - printf("Got annotation id %d, of type %d=%s, text length %d\n", - rec->annot_num, rec->type, rec_type, rec->text_length); - - // **************************** - // Read the rest of the record, from begining of possible text - // **************************** - - rec->buf = (char*)xrealloc(rec->buf, rec->length); - status = readbytes(annot_in_file, rec->buf+head_len, rec->length - head_len); - - if (status!=(rec->length - head_len)) - { - printf("Unable to read next part of annotation record - quiting\n"); - // fixme - we should stop processing annots but continue with rest - debug_pause(); - exit(1); - } - - if(rec->text_length>0) - { - rec->text=(char*)xmalloc(rec->text_length+1); - rec->text[rec->text_length]=0x0; - for (i=0;itext_length;i++) - rec->text[i]=rec->buf[text_offset + 2*i]; - str2ascii(rec->text); - } - - if (rec->type == ANNOT_TYPE_LINE) - { - rec->is_closed_line_flag = *(unsigned char*)(rec->buf + head_len - 9); - if( (rec->is_closed_line_flag != 0) && (rec->is_closed_line_flag != 1) ) - printf("Unexpected is_closed_line_flag=%d\n", rec->is_closed_line_flag); - } - - if (opts.verbose_flag > 1) - print_annot_rec(rec); - - if (opts.verbose_flag > 4) - { - printf("Recognised record with length %i\n",rec->length); - printbuf(rec->buf, rec->length); - } - - return rec; -} - -struct annotations * process_annotations_stream(char* annot_in_file_name) -{ - // Read the annotation file header - int i; - int status; - struct annot_rec * rec; - char* checkEOF; - int read_tail_buff=1; - FILE* annot_in_file=NULL; - struct annotations * annots = annotations_new(); - - int readbyte; -// int max_read_more; -// int readmore; - char* readmorebuf=NULL; -// char* strange=NULL; - float* strange_float=NULL; - struct annot_line_point * strange_pts=NULL; -// struct gpxpt* strange_gpxpt; - - annots->header_buf=(char*)xmalloc(ANNOT_FILE_HEAD_LEN); - - if ((annot_in_file = fopen(annot_in_file_name, "rb")) == NULL) - { - fprintf(stderr, "Quitting because I cannot open %s\n", annot_in_file_name); - debug_pause(); - exit(1); - } - - status=readbytes(annot_in_file, annots->header_buf, ANNOT_FILE_HEAD_LEN); - if (status!=ANNOT_FILE_HEAD_LEN) - { - printf("Cant make any more sense of annotations stream, continuing\n"); - return annots; - } - annots->stream_length += ANNOT_FILE_HEAD_LEN; - - for (i=1; i<4; i++) - if ( annots->header_buf[i] != std_annotfile_header[i] ) - printf("Nonstandard annotations file header, header[%i]=0x%x, normal value is 0x%x\n", - i, annots->header_buf[i], std_annotfile_header[i] ); - - annots->version = *(int*)(annots->header_buf+4); - if ((annots->version < 3) || (annots->version > 4)) - printf("Unexpected annotations version %d\n", annots->version); - - annots->num_annotations = *(int*)(annots->header_buf+8); - - annots->annot_list = (struct annot_rec **)xmalloc( - (annots->num_annotations)*sizeof(struct annot_rec*)); - - if (opts.verbose_flag > 1) - { - printf("Annotations file header, version %d, indicates %d annotations in file\n", - annots->version, annots->num_annotations); - } - - if (opts.verbose_flag > 4) - { - printf("Dumping file header:\n"); - printbuf(annots->header_buf, ANNOT_FILE_HEAD_LEN); - } - - /* - ** Read all the annotation records - */ - annots->read_recs_ok_flag = 1; - for (i=0; i < annots->num_annotations; i++) - { - rec = read_annot_rec(annot_in_file, annots->version); - -#ifdef EXPLORE - if (opts.explore_flag) - explore_annot(rec, annots->version); -#endif - if (rec==NULL) - { - annots->read_recs_ok_flag = 0; - annots->num_annotations = i-1; - read_tail_buff=0; - break; - } - - annots->annot_list[i] = rec; - annots->max_annot_num = __max(annots->max_annot_num, rec->annot_num); - annots->stream_length += rec->length; - } - - // fudge for White_West_Sts.ptm was here - - // Check that we are at the end of annotation file - if (read_tail_buff) - { - checkEOF = xmalloc(4); - status=readbytes(annot_in_file, checkEOF, 4); - annots->stream_length += status; - if ( (status!=4) || (checkEOF[0]!=0) || (checkEOF[1]!=0) - || (checkEOF[2]!=0) || (checkEOF[3]!=0) || - (readbyte=getc(annot_in_file)!=EOF) ) - { - fprintf (stderr, "Did not finish reading annotation file at EOF\n"); - //ungetc(readbyte, annot_in_file); - } - else - annots->read_tail_ok_flag=1; - free(checkEOF); - } - - fclose(annot_in_file); - return annots; -} diff --git a/st2gpx/src/annotations.h b/st2gpx/src/annotations.h deleted file mode 100644 index c70a636b1..000000000 --- a/st2gpx/src/annotations.h +++ /dev/null @@ -1,121 +0,0 @@ -/* - annotations.h - - Extract data from MS Streets & Trips .est, Autoroute .axe - and Mapoint .ptm files in GPX format. - - Copyright (C) 2003 James Sherring, james_sherring@yahoo.com - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111 USA - - - This app depends on istorage & istorage-make from Pabs (pabs3@zip.to) - and James Clark's Expat xml parser from http://www.libexpat.org/. - -*/ -#ifdef __cplusplus -extern "C" { -#endif - -#define ANNOT_FILE_HEAD_LEN 12 -// This needs to be long enough to get enough params to decide which record, -// but no biger than the shortest record -#define ANNOT_REC_HEAD_LEN 57 //19 - -#define ANNOT_TYPE_LINE 0 -#define ANNOT_TYPE_OVAL 1 -#define ANNOT_TYPE_TEXT 2 -#define ANNOT_TYPE_CIRCLE 3 - -#define REC_CLOSE_LEN 0 -// offsets for parameters in annotation recods -#define ANNOT_RECOS_TYPE 0 -#define ANNOT_RECOS_ANUM 4 -#define ANNOT_RECOS_TEXTLEN 20 -#define ANNOT_RECOS_TEXT 24 -#define ANNOT_RECOS_LINENUMPOINTS 53 -#define ANNOT_RECOS_LINEJOINFLAG 48 -#define ANNOT_RECOS_OVAL_POINTOS 136 // 24 for text + 4 + 11ints=44 + 1double=8 + 5pts=60 - -// + 12*NUM POINTS -#define LINE_REC_LEN_V3 57 -#define LINE_REC_LEN_V4 61 //??? - -struct f_annotations_file_head -{ - // always 0x2d001234 - unsigned int uiunkn0; - // autoroute 2001: version=3 - // autoroute 2003: version=4 - unsigned int version; - // number of annotations in the stream - unsigned int c_annots; -} ; - -struct annot_rec -{ - // ANNOT_TYPE_ - int type; - int length; - char* buf; - int annot_num; - int text_length; - char* text; - int line_points; - // Pointer to the line-points data in buf, - // because it moves with different file formats. - int line_offset; - unsigned char is_closed_line_flag; -}; - -struct annot_rec * annot_rec_new(); -void annot_rec_delete(struct annot_rec * annot_rec); - -struct annotations -{ - int num_annotations; - int max_annot_num; - char* header_buf; - struct annot_rec ** annot_list; - int tail_buf_length; - char read_recs_ok_flag; - char read_tail_ok_flag; - int stream_length; - // This is the annotations version number, as stored in the annotations stream - int version; -}; - -struct annotations * annotations_new(); -void annotations_delete(struct annotations * annots); -struct gpxpt* gpx_get_point(char* buf); -//struct gpxpt* gpx_get_point(struct annot_line_point* bufpt); - -extern char std_annotfile_header[ANNOT_FILE_HEAD_LEN]; -extern char std_annot_linerec_header_v3[LINE_REC_LEN_V3]; -extern char std_annot_linerec_header_v4[LINE_REC_LEN_V4]; - -//struct parameters { -// Also need to include variable text length + line-points with these -extern char* annot_type_name[4]; -extern char* gpxptypelabel[3]; -extern char * st_version[]; - -//} tag_parameters; - -struct annotations * process_annotations_stream(char* annot_in_file_name); - -#ifdef __cplusplus -} -#endif diff --git a/st2gpx/src/bugs.txt b/st2gpx/src/bugs.txt deleted file mode 100644 index 7e6c4377a..000000000 --- a/st2gpx/src/bugs.txt +++ /dev/null @@ -1,25 +0,0 @@ -st2gpx known issues - - -Features: - - Depends on ADO2.5 - - Known to work with Autoroute 2001, - - Probably works with Autoroute 2002-3, Streets & Trips 2000-4, Mappoint 2000-4, - but not fully tested - - Overwrites output files without warning - - -Bugs: - - Problem with input name "steph's wedding.est", - but "steph's wedding.est" is ok (single space) - - with input file "Plesivec - Plešivec.gpx" we fail to open the gpx as input - - exception importing gpx with long descriptions - mp2004 imported ppins: dont show info, accessing ballon property crashes mp - diff --git a/st2gpx/src/build.txt b/st2gpx/src/build.txt deleted file mode 100644 index a8830e18d..000000000 --- a/st2gpx/src/build.txt +++ /dev/null @@ -1,20 +0,0 @@ -Build instructions: - -Build from VC++6 project. -Important notes: -* Use of 1-Byte struct alignment is required (rather than the MS default of 8) - due to the technique used here of overlaying a struct on an input buffer. -* Use of #import at the top of pushpins.cpp requires setting the Visual Studio paths - to include ado libraries (c:\program files\common files\system\ado for me) - or setting the path explictitly in the #include statement. -* Use of libexpat reqires a separate install of libexpat, and setting the - Visual Studio include and library paths to include libexpat. For me these are - D:\gpsbabel\Expat-1.95.7\Source\lib (for includes) and D:\gpsbabel\Expat-1.95.7\Libs - (for libs). - -* Where possible, I have disabled MS language extensions (proj setting/c++/customize). - Exceptions are: - getopt.c (ms extensions are enabled only for win32) - properties.c (I have some unitialised arrays in file structs, I should clean this up) - pushpins.c (lots...) - But**** I have used various ms specific lib functions: __max, _fullpath, diff --git a/st2gpx/src/contents.c b/st2gpx/src/contents.c deleted file mode 100644 index 91d252d91..000000000 --- a/st2gpx/src/contents.c +++ /dev/null @@ -1,417 +0,0 @@ -/* - contents.c - - Extract data from MS Streets & Trips .est, Autoroute .axe - and Mapoint .ptm files in GPX format. - - Copyright (C) 2003 James Sherring, james_sherring@yahoo.com - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111 USA - - - This app depends on istorage & istorage-make from Pabs (pabs3@zip.to) - and James Clark's Expat xml parser from http://www.libexpat.org/. - -*/ -#include -#include -#include - -#include "st2gpx.h" -#include "gpx.h" -#include "contents.h" -#include "annotations.h" - -#ifdef EXPLORE -#include "explore.h" -#endif - -struct contents * contents_new() -{ - struct contents * nw = (struct contents*)xmalloc(sizeof(struct contents)); - nw->fully_parsed_flag=0; - nw->buf_len=0; - nw->buf=NULL; - nw->conts0_os=0; -//x nw->f_conts0=NULL; - nw->array_os=0; -//x nw->f_conts_array=NULL; - nw->f_pcbtext0=NULL; - nw->f_text0=NULL; - nw->conts1_os=0; -//x nw->f_conts1=NULL; - nw->f_text1=NULL; - nw->conts2_os=0; -//x nw->f_conts2=NULL; - // conts2->count_strings strings. - // Strings are not nul-terminated, - // but they are prefixed with their length. - nw->list_f_pcbtext=NULL; - nw->list_f_text=NULL; - nw->conts3_os=0; -//x nw->f_conts3=NULL; - // the end part of the buffer that has not been interpreted. - nw->rest=NULL; - return nw; -} - -void contents_delete(struct contents * conts) -{ - if(conts != NULL) - { - free(conts->list_f_pcbtext); - free(conts->list_f_text); - free(conts->buf); - } - free(conts); -} - -struct contents * parse_contents_buffer(char* buf, unsigned int buf_len) -{ - struct contents * conts = contents_new(); - unsigned int buf_pos=0; - unsigned int i; - unsigned int numstrings; - - conts->buf = buf; - conts->buf_len=buf_len; - - // ***************** - // Parse f_contents0 - // ***************** - - //x conts->f_conts0 = (struct f_contents0 *)(conts->buf); - conts->conts0_os=0; - //x buf_pos += sizeof(struct f_contents0); - buf_pos += CONT_RECSZ_C0; - - if (buf_pos>(conts->buf_len)) - { - printf("Oops, ran out of buffer with conts0.\n"); - return conts; - } - // ************************** - // Parse conts->f_conts_array - // ************************** - - //conts->f_conts_array=(unsigned short *)(conts->buf + buf_pos); - conts->array_os=buf_pos; - //buf_pos += conts->f_conts0->array_len; - buf_pos += *(unsigned int*)(conts->buf + CONT_RECOS_ARRAY_LEN); - if (buf_pos>(conts->buf_len)) - { - printf("Oops, ran out of buffer with conts array.\n"); - return conts; - } - - // ************************ - // Parse f_cbtext0, f_text0 - // ************************ - - conts->f_pcbtext0=(unsigned char*)((conts->buf)+buf_pos); - buf_pos += sizeof(char); - if (buf_pos>(conts->buf_len)) - { - printf("Oops, ran out of buffer with text0 size.\n"); - return conts; - } - - conts->f_text0=(conts->buf)+buf_pos; - buf_pos += *(conts->f_pcbtext0); - if (buf_pos>(conts->buf_len)) - { - printf("Oops, ran out of buffer with text0.\n"); - return conts; - } - - // ***************** - // Parse f_contents1 - // ***************** - - //x conts->f_conts1 = (struct f_contents1 *)(conts->buf+buf_pos); - conts->conts1_os = buf_pos; - //buf_pos += sizeof(struct f_contents1); - buf_pos += CONT_RECSZ_C1; - if (buf_pos>(conts->buf_len)) - { - printf("Oops, ran out of buffer with conts1.\n"); - return conts; - } - - // ************* - // Parse f_text1 - // ************* - - conts->f_text1 = (conts->buf)+buf_pos; - //x buf_pos += conts->f_conts1->cbText1; - buf_pos += *(unsigned char *)((conts->buf)+buf_pos-1); - if (buf_pos>(conts->buf_len)) - { - printf("Oops, ran out of buffer with text1.\n"); - return conts; - } - - // ***************** - // Parse f_contents2 - // ***************** - - //x conts->f_conts2 = (struct f_contents2 *)((conts->buf)+buf_pos); - conts->conts2_os = buf_pos; - //x buf_pos += sizeof(struct f_contents2); - buf_pos += CONT_RECSZ_C2; - if (buf_pos>(conts->buf_len)) - { - printf("Oops, ran out of buffer with conts2.\n"); - return conts; - } - - // *************************************** - // Parse list_f_cbtext[] and list_f_text[] - // *************************************** - - numstrings = *(unsigned short*)(conts->buf + conts->conts2_os + 4); - //x numstrings = conts->f_conts2->count_strings; - conts->list_f_pcbtext=(unsigned char**)xmalloc(numstrings*sizeof(unsigned char*)); - conts->list_f_text=(char**)xmalloc(numstrings*sizeof(char*)); - // initialise just incase we dont make it through the parse loop - for(i=0; ilist_f_pcbtext[i]=NULL; - conts->list_f_text[i]=NULL; - } - for(i=0; ilist_f_pcbtext[i]=(unsigned char*)(conts->buf+buf_pos); - buf_pos += sizeof(unsigned char); - if (buf_pos>(conts->buf_len)) - { - printf("Oops, ran out of buffer with text[%d] size.\n", i); - return conts; - } - conts->list_f_text[i]=(conts->buf)+buf_pos; - buf_pos += conts->list_f_pcbtext[i][0]; - if (buf_pos>(conts->buf_len)) - { - printf("Oops, ran out of buffer with text%d.\n", i); - return conts; - } - } - - // ************************** - // Parse pusunkn0 and piunkn1 - // ************************** - - conts->pusunkn0 = (unsigned short*)(conts->buf+buf_pos); - - buf_pos += sizeof(unsigned short); - if (buf_pos>(conts->buf_len)) - { - printf("Oops, ran out of buffer with pusunkn0.\n"); - return conts; - } - - if(*(conts->pusunkn0) == 1) - { - conts->piunkn1 = (int*)((conts->buf)+buf_pos); - buf_pos += sizeof(int); - if (buf_pos>(conts->buf_len)) - { - printf("Oops, ran out of buffer with piunkn1.\n"); - return conts; - } - } - - // ***************** - // Parse f_contents3 - // ***************** - - //x conts->f_conts3 = (struct f_contents3 *)(conts->buf+buf_pos); - conts->conts3_os = buf_pos; - //x buf_pos += sizeof(struct f_contents3); - buf_pos += CONT_RECSZ_C3; - if (buf_pos>(conts->buf_len)) - { - printf("Oops, ran out of buffer with conts3.\n"); - return conts; - } - - // ***************** - // Parse CountryText - // ***************** - - conts->CountryText = (conts->buf)+buf_pos; - //x buf_pos += conts->f_conts3->cbCountryText; - buf_pos += *(unsigned char *)((conts->buf)+buf_pos-1); - if (buf_pos>(conts->buf_len)) - { - printf("Oops, ran out of buffer with country text.\n"); - return conts; - } - - if (buf_pos == conts->buf_len) - conts->fully_parsed_flag=1; - else - { - printf("Unexpected %d bytes of contents buffer still remaining.\n", - (conts->buf_len)-buf_pos); - if(opts.verbose_flag > 4) - printbuf((conts->buf)+buf_pos, (conts->buf_len)-buf_pos); - } - -#ifdef EXPLORE - if (opts.explore_flag) - print_contents(conts); -#endif - - return conts; -} - -struct contents * read_contents(char* conts_file_name) -{ - FILE* conts_file=NULL; - const unsigned int max_conts_buf=1000; - int readbyte=0; - unsigned int buf_pos=0; - char* buf=(char*)xmalloc(max_conts_buf); - struct contents * conts=NULL; - - // **************************************** - // Read the Contents stream into the buffer - // **************************************** - - if ((conts_file = fopen(conts_file_name, "rb")) == NULL) - { - fprintf(stderr, "Cannot open property file %s\n", conts_file_name); - debug_pause(); - exit(3); - //return NULL; - } - - if ((readbyte = getc(conts_file))!=EOF) - { - do { - buf[buf_pos]=(char)readbyte; - buf_pos++; - if (buf_pos>max_conts_buf-1) - { - printf("oops, I didn't allocate enough buffer space for contents...\n"); - break; - } - } while ((readbyte = getc(conts_file))!=EOF); - - } - fclose(conts_file); - - if (opts.verbose_flag>2) - printf("Read %d bytes in contents stream %s\n", buf_pos, conts_file_name); - if (opts.verbose_flag>4) - { - printbuf(buf, buf_pos); - printf("Now trying to enterpret this data...\n"); - debug_pause(); - } - - conts = parse_contents_buffer(buf, buf_pos); - - debug_pause(); - return conts; -} - -struct contents * contents_insert_ppinset(struct contents * old_conts, unsigned short newSetId) -{ - // After inserting pushpins into UserData db, - // we need to update the Contents structure to include the new pushpin set - // in the list of objects to display. - // Otherwise the new pushpins will no be visible or editable. - struct contents * nw_conts=NULL; - char* nw_buf=NULL; - unsigned int nw_buf_len=0; - unsigned int insert_position=0; - unsigned int arraylen_os=0; - - if (old_conts==NULL) - { - printf("Contents buffer is empty???. The outut file will have a corrupted pushpin set.\n"); - return NULL; - } - - if (old_conts->fully_parsed_flag == 0) - { - printf("Warning - modifying a contents stream that is not fully parsed.\n"); - // Actually, we only need to have parsed as far as old_conts->f_conts_array, - // but best to be safe. - if(old_conts->CountryText !=NULL) - printf("...but I seem to have parsed enough to continue.\n"); - else - { - printf("I have not parsed enough to continue. The outut file will have a corrupted pushpin set.\n"); - return NULL; - } - } - - nw_buf_len = old_conts->buf_len + 2*sizeof(unsigned char); - nw_buf = (char *)xmalloc(nw_buf_len); - - // insert after f_conts_array[3], ie at f_conts_array+4 - //x insert_position = ((char*)(old_conts->f_conts_array+4)-(old_conts->buf)); - insert_position = old_conts->array_os + 8; - - memcpy(nw_buf, old_conts->buf, insert_position); - memcpy(nw_buf + insert_position, &newSetId, sizeof(unsigned short)); - memcpy(nw_buf + insert_position + sizeof(unsigned short), - old_conts->buf + insert_position, - old_conts->buf_len - insert_position); - - // set the size of the contents aray - //x arraylen_os = (char*)&(old_conts->f_conts0->array_len) - old_conts->buf; - arraylen_os = old_conts->array_os - 4; - *(nw_buf + arraylen_os) += sizeof(unsigned short); - - // increase the number of pushpin sets in f_conts_array[3] - *(nw_buf + insert_position - sizeof(unsigned short)) +=1; - - // increase section length - *(nw_buf + CONT_RECOS_SECT_LEN) +=2; - // increase iunkn20 - // *(int*)(nw_buf + old_conts->conts1_os + 2) +=1; - - nw_conts=parse_contents_buffer(nw_buf, nw_buf_len); - - return nw_conts; -} - -void write_contents(struct contents * conts, char* conts_file_name) -{ - FILE* conts_out_file; - int status; - - //printf("Writing new Contents stream to %s\n", conts_file_name); - - if ((conts_out_file = fopen(conts_file_name, "wb")) == NULL) { - fprintf(stderr, "Cannot open %s\n", conts_file_name); - fflush(stdout); - debug_pause(); - exit(1); - } - - status = fwrite(conts->buf, conts->buf_len, 1, conts_out_file); - if (status != 1) - printf("expected to write %d, actually wrote %d\n", conts->buf_len, status*(conts->buf_len)); - else - printf("Wrote %d bytes to new contents stream in %s\n", conts->buf_len, conts_file_name); - - fclose(conts_out_file); -} \ No newline at end of file diff --git a/st2gpx/src/contents.h b/st2gpx/src/contents.h deleted file mode 100644 index 6e71068a4..000000000 --- a/st2gpx/src/contents.h +++ /dev/null @@ -1,83 +0,0 @@ -/* - contents.h - - Extract data from MS Streets & Trips .est, Autoroute .axe - and Mapoint .ptm files in GPX format. - - Copyright (C) 2003 James Sherring, james_sherring@yahoo.com - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111 USA - - - This app depends on istorage & istorage-make from Pabs (pabs3@zip.to) - and James Clark's Expat xml parser from http://www.libexpat.org/. - -*/ -#ifdef __cplusplus -extern "C" { -#endif - -#define CONT_RECSZ_C0 108 -#define CONT_RECOS_SECT_LEN 98 -#define CONT_RECOS_ARRAY_LEN 104 -#define CONT_RECSZ_C1 5 -#define CONT_RECSZ_C2 6 -#define CONT_RECSZ_C3 9 - - -struct contents -{ - int fully_parsed_flag; - unsigned int buf_len; - // The data as read from the contents stream. - char* buf; - int conts0_os; - //x struct f_contents0 * f_conts0; - int array_os; - //x unsigned short * f_conts_array; - unsigned char * f_pcbtext0; - char* f_text0; - int conts1_os; - //x struct f_contents1 * f_conts1; - char* f_text1; - int conts2_os; - //x struct f_contents2 * f_conts2; - // Lengths for conts2->count_strings number of strings. - // Note that this is array of *pointers* to string-length - unsigned char ** list_f_pcbtext; - // conts2->count_strings number of strings. - // Strings are not null-terminated, - // but they are prefixed with their length. - char ** list_f_text; - // Normally 0, sometimes 1 - unsigned short * pusunkn0; - // Only when usunkn0=1 ??? - int * piunkn1; - int conts3_os; - //x struct f_contents3 * f_conts3; - char * CountryText; - // The end part of the buffer that has not been interpreted. - char* rest; -} ; - -struct contents * read_contents(char* conts_file_name); -struct contents * contents_insert_ppinset(struct contents * old_conts, unsigned short newSetId); -void write_contents(struct contents * conts, char* conts_file_name); -void contents_delete(struct contents * conts); - -#ifdef __cplusplus -} -#endif - diff --git a/st2gpx/src/debug.c b/st2gpx/src/debug.c deleted file mode 100644 index e640d8282..000000000 --- a/st2gpx/src/debug.c +++ /dev/null @@ -1,105 +0,0 @@ -/* - debug.c - - Extract data from MS Streets & Trips .est, Autoroute .axe - and Mapoint .ptm files in GPX format. - - Copyright (C) 2003 James Sherring, james_sherring@yahoo.com - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111 USA - - - This app depends on istorage & istorage-make from Pabs (pabs3@zip.to) - and James Clark's Expat xml parser from http://www.libexpat.org/. - -*/ -#include -#include -#include - -#include "gpx.h" -#include "st2gpx.h" -#include "getopt.h" -#include "properties.h" -#include "pushpins.h" -#include "ppinutil.h" -#include "annotations.h" -#include "journey.h" - -void debug_pause() -{ - char c; - if (opts.debug_wait_flag) - { - fprintf(stderr, "Hit Enter key to continue\n"); - c=getchar(); - // a way to stop pausing - if (c=='q') - opts.debug_wait_flag=0; - } -} - -void printbuf(char* buf, int len) -{ - int i; - unsigned char * ubuf = (unsigned char *)buf; - printf(" 0 1 2 3 4 5 6 7 8 9 A B C D E F\n"); - printf(" -----------------------------------------------"); - for(i=0; i. - Ditto for AIX 3.2 and . */ -#ifndef _NO_PROTO -#define _NO_PROTO -#endif - -#ifdef HAVE_CONFIG_H -#include -#endif - -#if !defined (__STDC__) || !__STDC__ -/* This is a separate conditional since some stdc systems - reject `defined (const)'. */ -#ifndef const -#define const -#endif -#endif - -#include - -/* Comment out all this code if we are using the GNU C Library, and are not - actually compiling the library itself. This code is part of the GNU C - Library, but also included in many other GNU distributions. Compiling - and linking in this code is a waste when using the GNU C library - (especially if it is a shared library). Rather than having every GNU - program understand `configure --with-gnu-libc' and omit the object files, - it is simpler to just do this in the source for each such file. */ - -#define GETOPT_INTERFACE_VERSION 2 -#if !defined (_LIBC) && defined (__GLIBC__) && __GLIBC__ >= 2 -#include -#if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION -#define ELIDE_CODE -#endif -#endif - -#ifndef ELIDE_CODE - - -/* This needs to come after some library #include - to get __GNU_LIBRARY__ defined. */ -#ifdef __GNU_LIBRARY__ -/* Don't include stdlib.h for non-GNU C libraries because some of them - contain conflicting prototypes for getopt. */ -#include -#include -#endif /* GNU C library. */ - -#ifdef VMS -#include -#if HAVE_STRING_H - 0 -#include -#endif -#endif - -#if defined (WIN32) && !defined (__CYGWIN32__) -/* It's not Unix, really. See? Capital letters. */ -#include -#define getpid() GetCurrentProcessId() -#endif - -#ifndef _ -/* This is for other GNU distributions with internationalized messages. - When compiling libc, the _ macro is predefined. */ -#ifdef HAVE_LIBINTL_H -# include -# define _(msgid) gettext (msgid) -#else -# define _(msgid) (msgid) -#endif -#endif - -/* This version of `getopt' appears to the caller like standard Unix `getopt' - but it behaves differently for the user, since it allows the user - to intersperse the options with the other arguments. - - As `getopt' works, it permutes the elements of ARGV so that, - when it is done, all the options precede everything else. Thus - all application programs are extended to handle flexible argument order. - - Setting the environment variable POSIXLY_CORRECT disables permutation. - Then the behavior is completely standard. - - GNU application programs can use a third alternative mode in which - they can distinguish the relative order of options and other arguments. */ - -#include "getopt.h" - -/* For communication from `getopt' to the caller. - When `getopt' finds an option that takes an argument, - the argument value is returned here. - Also, when `ordering' is RETURN_IN_ORDER, - each non-option ARGV-element is returned here. */ - -char *optarg = NULL; - -/* Index in ARGV of the next element to be scanned. - This is used for communication to and from the caller - and for communication between successive calls to `getopt'. - - On entry to `getopt', zero means this is the first call; initialize. - - When `getopt' returns -1, this is the index of the first of the - non-option elements that the caller should itself scan. - - Otherwise, `optind' communicates from one call to the next - how much of ARGV has been scanned so far. */ - -/* 1003.2 says this must be 1 before any call. */ -int optind = 1; - -/* Formerly, initialization of getopt depended on optind==0, which - causes problems with re-calling getopt as programs generally don't - know that. */ - -int __getopt_initialized = 0; - -/* The next char to be scanned in the option-element - in which the last option character we returned was found. - This allows us to pick up the scan where we left off. - - If this is zero, or a null string, it means resume the scan - by advancing to the next ARGV-element. */ - -static char *nextchar; - -/* Callers store zero here to inhibit the error message - for unrecognized options. */ - -int opterr = 1; - -/* Set to an option character which was unrecognized. - This must be initialized on some systems to avoid linking in the - system's own getopt implementation. */ - -int optopt = '?'; - -/* Describe how to deal with options that follow non-option ARGV-elements. - - If the caller did not specify anything, - the default is REQUIRE_ORDER if the environment variable - POSIXLY_CORRECT is defined, PERMUTE otherwise. - - REQUIRE_ORDER means don't recognize them as options; - stop option processing when the first non-option is seen. - This is what Unix does. - This mode of operation is selected by either setting the environment - variable POSIXLY_CORRECT, or using `+' as the first character - of the list of option characters. - - PERMUTE is the default. We permute the contents of ARGV as we scan, - so that eventually all the non-options are at the end. This allows options - to be given in any order, even with programs that were not written to - expect this. - - RETURN_IN_ORDER is an option available to programs that were written - to expect options and other ARGV-elements in any order and that care about - the ordering of the two. We describe each non-option ARGV-element - as if it were the argument of an option with character code 1. - Using `-' as the first character of the list of option characters - selects this mode of operation. - - The special argument `--' forces an end of option-scanning regardless - of the value of `ordering'. In the case of RETURN_IN_ORDER, only - `--' can cause `getopt' to return -1 with `optind' != ARGC. */ - -static enum -{ - REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER -} ordering; - -/* Value of POSIXLY_CORRECT environment variable. */ -static char *posixly_correct; - -#ifdef __GNU_LIBRARY__ -/* We want to avoid inclusion of string.h with non-GNU libraries - because there are many ways it can cause trouble. - On some systems, it contains special magic macros that don't work - in GCC. */ -#include -#define my_index strchr -#else - -/* Avoid depending on library functions or files - whose names are inconsistent. */ - -char *getenv (); - -static char * -my_index (str, chr) - const char *str; - int chr; -{ - while (*str) - { - if (*str == chr) - return (char *) str; - str++; - } - return 0; -} - -/* If using GCC, we can safely declare strlen this way. - If not using GCC, it is ok not to declare it. */ -#ifdef __GNUC__ -/* Note that Motorola Delta 68k R3V7 comes with GCC but not stddef.h. - That was relevant to code that was here before. */ -#if !defined (__STDC__) || !__STDC__ -/* gcc with -traditional declares the built-in strlen to return int, - and has done so at least since version 2.4.5. -- rms. */ -extern int strlen (const char *); -#endif /* not __STDC__ */ -#endif /* __GNUC__ */ - -#endif /* not __GNU_LIBRARY__ */ - -/* Handle permutation of arguments. */ - -/* Describe the part of ARGV that contains non-options that have - been skipped. `first_nonopt' is the index in ARGV of the first of them; - `last_nonopt' is the index after the last of them. */ - -static int first_nonopt; -static int last_nonopt; - -#ifdef _LIBC -/* Bash 2.0 gives us an environment variable containing flags - indicating ARGV elements that should not be considered arguments. */ - -/* Defined in getopt_init.c */ -extern char *__getopt_nonoption_flags; - -static int nonoption_flags_max_len; -static int nonoption_flags_len; - -static int original_argc; -static char *const *original_argv; - -extern pid_t __libc_pid; - -/* Make sure the environment variable bash 2.0 puts in the environment - is valid for the getopt call we must make sure that the ARGV passed - to getopt is that one passed to the process. */ -static void -__attribute__ ((unused)) -store_args_and_env (int argc, char *const *argv) -{ - /* XXX This is no good solution. We should rather copy the args so - that we can compare them later. But we must not use malloc(3). */ - original_argc = argc; - original_argv = argv; -} -text_set_element (__libc_subinit, store_args_and_env); - -# define SWAP_FLAGS(ch1, ch2) \ - if (nonoption_flags_len > 0) \ - { \ - char __tmp = __getopt_nonoption_flags[ch1]; \ - __getopt_nonoption_flags[ch1] = __getopt_nonoption_flags[ch2]; \ - __getopt_nonoption_flags[ch2] = __tmp; \ - } -#else /* !_LIBC */ -# define SWAP_FLAGS(ch1, ch2) -#endif /* _LIBC */ - -/* Exchange two adjacent subsequences of ARGV. - One subsequence is elements [first_nonopt,last_nonopt) - which contains all the non-options that have been skipped so far. - The other is elements [last_nonopt,optind), which contains all - the options processed since those non-options were skipped. - - `first_nonopt' and `last_nonopt' are relocated so that they describe - the new indices of the non-options in ARGV after they are moved. */ - -#if defined (__STDC__) && __STDC__ -static void exchange (char **); -#endif - -static void -exchange (argv) - char **argv; -{ - int bottom = first_nonopt; - int middle = last_nonopt; - int top = optind; - char *tem; - - /* Exchange the shorter segment with the far end of the longer segment. - That puts the shorter segment into the right place. - It leaves the longer segment in the right place overall, - but it consists of two parts that need to be swapped next. */ - -#ifdef _LIBC - /* First make sure the handling of the `__getopt_nonoption_flags' - string can work normally. Our top argument must be in the range - of the string. */ - if (nonoption_flags_len > 0 && top >= nonoption_flags_max_len) - { - /* We must extend the array. The user plays games with us and - presents new arguments. */ - char *new_str = malloc (top + 1); - if (new_str == NULL) - nonoption_flags_len = nonoption_flags_max_len = 0; - else - { - memcpy (new_str, __getopt_nonoption_flags, nonoption_flags_max_len); - memset (&new_str[nonoption_flags_max_len], '\0', - top + 1 - nonoption_flags_max_len); - nonoption_flags_max_len = top + 1; - __getopt_nonoption_flags = new_str; - } - } -#endif - - while (top > middle && middle > bottom) - { - if (top - middle > middle - bottom) - { - /* Bottom segment is the short one. */ - int len = middle - bottom; - register int i; - - /* Swap it with the top part of the top segment. */ - for (i = 0; i < len; i++) - { - tem = argv[bottom + i]; - argv[bottom + i] = argv[top - (middle - bottom) + i]; - argv[top - (middle - bottom) + i] = tem; - SWAP_FLAGS (bottom + i, top - (middle - bottom) + i); - } - /* Exclude the moved bottom segment from further swapping. */ - top -= len; - } - else - { - /* Top segment is the short one. */ - int len = top - middle; - register int i; - - /* Swap it with the bottom part of the bottom segment. */ - for (i = 0; i < len; i++) - { - tem = argv[bottom + i]; - argv[bottom + i] = argv[middle + i]; - argv[middle + i] = tem; - SWAP_FLAGS (bottom + i, middle + i); - } - /* Exclude the moved top segment from further swapping. */ - bottom += len; - } - } - - /* Update records for the slots the non-options now occupy. */ - - first_nonopt += (optind - last_nonopt); - last_nonopt = optind; -} - -/* Initialize the internal data when the first call is made. */ - -#if defined (__STDC__) && __STDC__ -static const char *_getopt_initialize (int, char *const *, const char *); -#endif -static const char * -_getopt_initialize (argc, argv, optstring) - int argc; - char *const *argv; - const char *optstring; -{ - /* Start processing options with ARGV-element 1 (since ARGV-element 0 - is the program name); the sequence of previously skipped - non-option ARGV-elements is empty. */ - - first_nonopt = last_nonopt = optind; - - nextchar = NULL; - - posixly_correct = getenv ("POSIXLY_CORRECT"); - - /* Determine how to handle the ordering of options and nonoptions. */ - - if (optstring[0] == '-') - { - ordering = RETURN_IN_ORDER; - ++optstring; - } - else if (optstring[0] == '+') - { - ordering = REQUIRE_ORDER; - ++optstring; - } - else if (posixly_correct != NULL) - ordering = REQUIRE_ORDER; - else - ordering = PERMUTE; - -#ifdef _LIBC - if (posixly_correct == NULL - && argc == original_argc && argv == original_argv) - { - if (nonoption_flags_max_len == 0) - { - if (__getopt_nonoption_flags == NULL - || __getopt_nonoption_flags[0] == '\0') - nonoption_flags_max_len = -1; - else - { - const char *orig_str = __getopt_nonoption_flags; - int len = nonoption_flags_max_len = strlen (orig_str); - if (nonoption_flags_max_len < argc) - nonoption_flags_max_len = argc; - __getopt_nonoption_flags = - (char *) malloc (nonoption_flags_max_len); - if (__getopt_nonoption_flags == NULL) - nonoption_flags_max_len = -1; - else - { - memcpy (__getopt_nonoption_flags, orig_str, len); - memset (&__getopt_nonoption_flags[len], '\0', - nonoption_flags_max_len - len); - } - } - } - nonoption_flags_len = nonoption_flags_max_len; - } - else - nonoption_flags_len = 0; -#endif - - return optstring; -} - -/* Scan elements of ARGV (whose length is ARGC) for option characters - given in OPTSTRING. - - If an element of ARGV starts with '-', and is not exactly "-" or "--", - then it is an option element. The characters of this element - (aside from the initial '-') are option characters. If `getopt' - is called repeatedly, it returns successively each of the option characters - from each of the option elements. - - If `getopt' finds another option character, it returns that character, - updating `optind' and `nextchar' so that the next call to `getopt' can - resume the scan with the following option character or ARGV-element. - - If there are no more option characters, `getopt' returns -1. - Then `optind' is the index in ARGV of the first ARGV-element - that is not an option. (The ARGV-elements have been permuted - so that those that are not options now come last.) - - OPTSTRING is a string containing the legitimate option characters. - If an option character is seen that is not listed in OPTSTRING, - return '?' after printing an error message. If you set `opterr' to - zero, the error message is suppressed but we still return '?'. - - If a char in OPTSTRING is followed by a colon, that means it wants an arg, - so the following text in the same ARGV-element, or the text of the following - ARGV-element, is returned in `optarg'. Two colons mean an option that - wants an optional arg; if there is text in the current ARGV-element, - it is returned in `optarg', otherwise `optarg' is set to zero. - - If OPTSTRING starts with `-' or `+', it requests different methods of - handling the non-option ARGV-elements. - See the comments about RETURN_IN_ORDER and REQUIRE_ORDER, above. - - Long-named options begin with `--' instead of `-'. - Their names may be abbreviated as long as the abbreviation is unique - or is an exact match for some defined option. If they have an - argument, it follows the option name in the same ARGV-element, separated - from the option name by a `=', or else the in next ARGV-element. - When `getopt' finds a long-named option, it returns 0 if that option's - `flag' field is nonzero, the value of the option's `val' field - if the `flag' field is zero. - - The elements of ARGV aren't really const, because we permute them. - But we pretend they're const in the prototype to be compatible - with other systems. - - LONGOPTS is a vector of `struct option' terminated by an - element containing a name which is zero. - - LONGIND returns the index in LONGOPT of the long-named option found. - It is only valid when a long-named option has been found by the most - recent call. - - If LONG_ONLY is nonzero, '-' as well as '--' can introduce - long-named options. */ - -int -_getopt_internal (argc, argv, optstring, longopts, longind, long_only) - int argc; - char *const *argv; - const char *optstring; - const struct option *longopts; - int *longind; - int long_only; -{ - optarg = NULL; - - if (optind == 0 || !__getopt_initialized) - { - if (optind == 0) - optind = 1; /* Don't scan ARGV[0], the program name. */ - optstring = _getopt_initialize (argc, argv, optstring); - __getopt_initialized = 1; - } - - /* Test whether ARGV[optind] points to a non-option argument. - Either it does not have option syntax, or there is an environment flag - from the shell indicating it is not an option. The later information - is only used when the used in the GNU libc. */ -#ifdef _LIBC -#define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0' \ - || (optind < nonoption_flags_len \ - && __getopt_nonoption_flags[optind] == '1')) -#else -#define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0') -#endif - - if (nextchar == NULL || *nextchar == '\0') - { - /* Advance to the next ARGV-element. */ - - /* Give FIRST_NONOPT & LAST_NONOPT rational values if OPTIND has been - moved back by the user (who may also have changed the arguments). */ - if (last_nonopt > optind) - last_nonopt = optind; - if (first_nonopt > optind) - first_nonopt = optind; - - if (ordering == PERMUTE) - { - /* If we have just processed some options following some non-options, - exchange them so that the options come first. */ - - if (first_nonopt != last_nonopt && last_nonopt != optind) - exchange ((char **) argv); - else if (last_nonopt != optind) - first_nonopt = optind; - - /* Skip any additional non-options - and extend the range of non-options previously skipped. */ - - while (optind < argc && NONOPTION_P) - optind++; - last_nonopt = optind; - } - - /* The special ARGV-element `--' means premature end of options. - Skip it like a null option, - then exchange with previous non-options as if it were an option, - then skip everything else like a non-option. */ - - if (optind != argc && !strcmp (argv[optind], "--")) - { - optind++; - - if (first_nonopt != last_nonopt && last_nonopt != optind) - exchange ((char **) argv); - else if (first_nonopt == last_nonopt) - first_nonopt = optind; - last_nonopt = argc; - - optind = argc; - } - - /* If we have done all the ARGV-elements, stop the scan - and back over any non-options that we skipped and permuted. */ - - if (optind == argc) - { - /* Set the next-arg-index to point at the non-options - that we previously skipped, so the caller will digest them. */ - if (first_nonopt != last_nonopt) - optind = first_nonopt; - return -1; - } - - /* If we have come to a non-option and did not permute it, - either stop the scan or describe it to the caller and pass it by. */ - - if (NONOPTION_P) - { - if (ordering == REQUIRE_ORDER) - return -1; - optarg = argv[optind++]; - return 1; - } - - /* We have found another option-ARGV-element. - Skip the initial punctuation. */ - - nextchar = (argv[optind] + 1 - + (longopts != NULL && argv[optind][1] == '-')); - } - - /* Decode the current option-ARGV-element. */ - - /* Check whether the ARGV-element is a long option. - - If long_only and the ARGV-element has the form "-f", where f is - a valid short option, don't consider it an abbreviated form of - a long option that starts with f. Otherwise there would be no - way to give the -f short option. - - On the other hand, if there's a long option "fubar" and - the ARGV-element is "-fu", do consider that an abbreviation of - the long option, just like "--fu", and not "-f" with arg "u". - - This distinction seems to be the most useful approach. */ - - if (longopts != NULL - && (argv[optind][1] == '-' - || (long_only && (argv[optind][2] || !my_index (optstring, argv[optind][1]))))) - { - char *nameend; - const struct option *p; - const struct option *pfound = NULL; - int exact = 0; - int ambig = 0; - int indfound = -1; - int option_index; - - for (nameend = nextchar; *nameend && *nameend != '='; nameend++) - /* Do nothing. */ ; - - /* Test all long options for either exact match - or abbreviated matches. */ - for (p = longopts, option_index = 0; p->name; p++, option_index++) - if (!strncmp (p->name, nextchar, nameend - nextchar)) - { - if ((unsigned int) (nameend - nextchar) - == (unsigned int) strlen (p->name)) - { - /* Exact match found. */ - pfound = p; - indfound = option_index; - exact = 1; - break; - } - else if (pfound == NULL) - { - /* First nonexact match found. */ - pfound = p; - indfound = option_index; - } - else - /* Second or later nonexact match found. */ - ambig = 1; - } - - if (ambig && !exact) - { - if (opterr) - fprintf (stderr, _("%s: option `%s' is ambiguous\n"), - argv[0], argv[optind]); - nextchar += strlen (nextchar); - optind++; - optopt = 0; - return '?'; - } - - if (pfound != NULL) - { - option_index = indfound; - optind++; - if (*nameend) - { - /* Don't test has_arg with >, because some C compilers don't - allow it to be used on enums. */ - if (pfound->has_arg) - optarg = nameend + 1; - else - { - if (opterr) - if (argv[optind - 1][1] == '-') - /* --option */ - fprintf (stderr, - _("%s: option `--%s' doesn't allow an argument\n"), - argv[0], pfound->name); - else - /* +option or -option */ - fprintf (stderr, - _("%s: option `%c%s' doesn't allow an argument\n"), - argv[0], argv[optind - 1][0], pfound->name); - - nextchar += strlen (nextchar); - - optopt = pfound->val; - return '?'; - } - } - else if (pfound->has_arg == 1) - { - if (optind < argc) - optarg = argv[optind++]; - else - { - if (opterr) - fprintf (stderr, - _("%s: option `%s' requires an argument\n"), - argv[0], argv[optind - 1]); - nextchar += strlen (nextchar); - optopt = pfound->val; - return optstring[0] == ':' ? ':' : '?'; - } - } - nextchar += strlen (nextchar); - if (longind != NULL) - *longind = option_index; - if (pfound->flag) - { - *(pfound->flag) = pfound->val; - return 0; - } - return pfound->val; - } - - /* Can't find it as a long option. If this is not getopt_long_only, - or the option starts with '--' or is not a valid short - option, then it's an error. - Otherwise interpret it as a short option. */ - if (!long_only || argv[optind][1] == '-' - || my_index (optstring, *nextchar) == NULL) - { - if (opterr) - { - if (argv[optind][1] == '-') - /* --option */ - fprintf (stderr, _("%s: unrecognized option `--%s'\n"), - argv[0], nextchar); - else - /* +option or -option */ - fprintf (stderr, _("%s: unrecognized option `%c%s'\n"), - argv[0], argv[optind][0], nextchar); - } - nextchar = (char *) ""; - optind++; - optopt = 0; - return '?'; - } - } - - /* Look at and handle the next short option-character. */ - - { - char c = *nextchar++; - char *temp = my_index (optstring, c); - - /* Increment `optind' when we start to process its last character. */ - if (*nextchar == '\0') - ++optind; - - if (temp == NULL || c == ':') - { - if (opterr) - { - if (posixly_correct) - /* 1003.2 specifies the format of this message. */ - fprintf (stderr, _("%s: illegal option -- %c\n"), - argv[0], c); - else - fprintf (stderr, _("%s: invalid option -- %c\n"), - argv[0], c); - } - optopt = c; - return '?'; - } - /* Convenience. Treat POSIX -W foo same as long option --foo */ - if (temp[0] == 'W' && temp[1] == ';') - { - char *nameend; - const struct option *p; - const struct option *pfound = NULL; - int exact = 0; - int ambig = 0; - int indfound = 0; - int option_index; - - /* This is an option that requires an argument. */ - if (*nextchar != '\0') - { - optarg = nextchar; - /* If we end this ARGV-element by taking the rest as an arg, - we must advance to the next element now. */ - optind++; - } - else if (optind == argc) - { - if (opterr) - { - /* 1003.2 specifies the format of this message. */ - fprintf (stderr, _("%s: option requires an argument -- %c\n"), - argv[0], c); - } - optopt = c; - if (optstring[0] == ':') - c = ':'; - else - c = '?'; - return c; - } - else - /* We already incremented `optind' once; - increment it again when taking next ARGV-elt as argument. */ - optarg = argv[optind++]; - - /* optarg is now the argument, see if it's in the - table of longopts. */ - - for (nextchar = nameend = optarg; *nameend && *nameend != '='; nameend++) - /* Do nothing. */ ; - - /* Test all long options for either exact match - or abbreviated matches. */ - for (p = longopts, option_index = 0; p->name; p++, option_index++) - if (!strncmp (p->name, nextchar, nameend - nextchar)) - { - if ((unsigned int) (nameend - nextchar) == strlen (p->name)) - { - /* Exact match found. */ - pfound = p; - indfound = option_index; - exact = 1; - break; - } - else if (pfound == NULL) - { - /* First nonexact match found. */ - pfound = p; - indfound = option_index; - } - else - /* Second or later nonexact match found. */ - ambig = 1; - } - if (ambig && !exact) - { - if (opterr) - fprintf (stderr, _("%s: option `-W %s' is ambiguous\n"), - argv[0], argv[optind]); - nextchar += strlen (nextchar); - optind++; - return '?'; - } - if (pfound != NULL) - { - option_index = indfound; - if (*nameend) - { - /* Don't test has_arg with >, because some C compilers don't - allow it to be used on enums. */ - if (pfound->has_arg) - optarg = nameend + 1; - else - { - if (opterr) - fprintf (stderr, _("\ -%s: option `-W %s' doesn't allow an argument\n"), - argv[0], pfound->name); - - nextchar += strlen (nextchar); - return '?'; - } - } - else if (pfound->has_arg == 1) - { - if (optind < argc) - optarg = argv[optind++]; - else - { - if (opterr) - fprintf (stderr, - _("%s: option `%s' requires an argument\n"), - argv[0], argv[optind - 1]); - nextchar += strlen (nextchar); - return optstring[0] == ':' ? ':' : '?'; - } - } - nextchar += strlen (nextchar); - if (longind != NULL) - *longind = option_index; - if (pfound->flag) - { - *(pfound->flag) = pfound->val; - return 0; - } - return pfound->val; - } - nextchar = NULL; - return 'W'; /* Let the application handle it. */ - } - if (temp[1] == ':') - { - if (temp[2] == ':') - { - /* This is an option that accepts an argument optionally. */ - if (*nextchar != '\0') - { - optarg = nextchar; - optind++; - } - else - optarg = NULL; - nextchar = NULL; - } - else - { - /* This is an option that requires an argument. */ - if (*nextchar != '\0') - { - optarg = nextchar; - /* If we end this ARGV-element by taking the rest as an arg, - we must advance to the next element now. */ - optind++; - } - else if (optind == argc) - { - if (opterr) - { - /* 1003.2 specifies the format of this message. */ - fprintf (stderr, - _("%s: option requires an argument -- %c\n"), - argv[0], c); - } - optopt = c; - if (optstring[0] == ':') - c = ':'; - else - c = '?'; - } - else - /* We already incremented `optind' once; - increment it again when taking next ARGV-elt as argument. */ - optarg = argv[optind++]; - nextchar = NULL; - } - } - return c; - } -} - -int -getopt (argc, argv, optstring) - int argc; - char *const *argv; - const char *optstring; -{ - return _getopt_internal (argc, argv, optstring, - (const struct option *) 0, - (int *) 0, - 0); -} - -#endif /* Not ELIDE_CODE. */ - -#ifdef TEST - -/* Compile with -DTEST to make an executable for use in testing - the above definition of `getopt'. */ - -int -main (argc, argv) - int argc; - char **argv; -{ - int c; - int digit_optind = 0; - - while (1) - { - int this_option_optind = optind ? optind : 1; - - c = getopt (argc, argv, "abc:d:0123456789"); - if (c == -1) - break; - - switch (c) - { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - if (digit_optind != 0 && digit_optind != this_option_optind) - printf ("digits occur in two different argv-elements.\n"); - digit_optind = this_option_optind; - printf ("option %c\n", c); - break; - - case 'a': - printf ("option a\n"); - break; - - case 'b': - printf ("option b\n"); - break; - - case 'c': - printf ("option c with value `%s'\n", optarg); - break; - - case '?': - break; - - default: - printf ("?? getopt returned character code 0%o ??\n", c); - } - } - - if (optind < argc) - { - printf ("non-option ARGV-elements: "); - while (optind < argc) - printf ("%s ", argv[optind++]); - printf ("\n"); - } - - exit (0); -} - -#endif /* TEST */ diff --git a/st2gpx/src/getopt.h b/st2gpx/src/getopt.h deleted file mode 100644 index a0fe18aee..000000000 --- a/st2gpx/src/getopt.h +++ /dev/null @@ -1,131 +0,0 @@ -/* Declarations for getopt. - Copyright (C) 1989,90,91,92,93,94,96,97 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#ifndef _GETOPT_H -#define _GETOPT_H 1 - -#ifdef __cplusplus -extern "C" { -#endif - -/* For communication from `getopt' to the caller. - When `getopt' finds an option that takes an argument, - the argument value is returned here. - Also, when `ordering' is RETURN_IN_ORDER, - each non-option ARGV-element is returned here. */ - -extern char *optarg; - -/* Index in ARGV of the next element to be scanned. - This is used for communication to and from the caller - and for communication between successive calls to `getopt'. - - On entry to `getopt', zero means this is the first call; initialize. - - When `getopt' returns -1, this is the index of the first of the - non-option elements that the caller should itself scan. - - Otherwise, `optind' communicates from one call to the next - how much of ARGV has been scanned so far. */ - -extern int optind; - -/* Callers store zero here to inhibit the error message `getopt' prints - for unrecognized options. */ - -extern int opterr; - -/* Set to an option character which was unrecognized. */ - -extern int optopt; - -/* Describe the long-named options requested by the application. - The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector - of `struct option' terminated by an element containing a name which is - zero. - - The field `has_arg' is: - no_argument (or 0) if the option does not take an argument, - required_argument (or 1) if the option requires an argument, - optional_argument (or 2) if the option takes an optional argument. - - If the field `flag' is not NULL, it points to a variable that is set - to the value given in the field `val' when the option is found, but - left unchanged if the option is not found. - - To have a long-named option do something other than set an `int' to - a compiled-in constant, such as set a value from `optarg', set the - option's `flag' field to zero and its `val' field to a nonzero - value (the equivalent single-letter option character, if there is - one). For long options that have a zero `flag' field, `getopt' - returns the contents of the `val' field. */ - -struct option -{ -#if defined (__STDC__) && __STDC__ - const char *name; -#else - char *name; -#endif - /* has_arg can't be an enum because some compilers complain about - type mismatches in all the code that assumes it is an int. */ - int has_arg; - int *flag; - int val; -}; - -/* Names for the values of the `has_arg' field of `struct option'. */ - -#define no_argument 0 -#define required_argument 1 -#define optional_argument 2 - -//#if defined (__STDC__) && __STDC__ -//#ifdef __GNU_LIBRARY__ -/* Many other libraries have conflicting prototypes for getopt, with - differences in the consts, in stdlib.h. To avoid compilation - errors, only prototype getopt for the GNU C library. */ -extern int getopt (int argc, char *const *argv, const char *shortopts); -//#else /* not __GNU_LIBRARY__ */ -extern int getopt (); -//#endif /* __GNU_LIBRARY__ */ -extern int getopt_long (int argc, char *const *argv, const char *shortopts, - const struct option *longopts, int *longind); -extern int getopt_long_only (int argc, char *const *argv, - const char *shortopts, - const struct option *longopts, int *longind); - -/* Internal only. Users should not call this directly. */ -extern int _getopt_internal (int argc, char *const *argv, - const char *shortopts, - const struct option *longopts, int *longind, - int long_only); -//#else /* not __STDC__ */ -//extern int getopt (); -//extern int getopt_long (); -//extern int getopt_long_only (); - -//extern int _getopt_internal (); -//#endif /* __STDC__ */ - -#ifdef __cplusplus -} -#endif - -#endif /* _GETOPT_H */ diff --git a/st2gpx/src/gpx.h b/st2gpx/src/gpx.h deleted file mode 100644 index edf15e06f..000000000 --- a/st2gpx/src/gpx.h +++ /dev/null @@ -1,116 +0,0 @@ -/* - gpx.h - - Extract data from MS Streets & Trips .est, Autoroute .axe - and Mapoint .ptm files in GPX format. - - Copyright (C) 2003 James Sherring, james_sherring@yahoo.com - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111 USA - - - This app depends on istorage & istorage-make from Pabs (pabs3@zip.to) - and James Clark's Expat xml parser from http://www.libexpat.org/. - -*/ -#ifdef __cplusplus -extern "C" { -#endif - -#define GPX_ELEM_TYPE_WPT 1 -#define GPX_ELEM_TYPE_RTE 2 -#define GPX_ELEM_TYPE_RTEPT 3 -#define GPX_ELEM_TYPE_TRK 4 -#define GPX_ELEM_TYPE_TRKSEG 5 -#define GPX_ELEM_TYPE_TRKPT 6 - -#define GPX_ELEM_TYPE_NAME 7 -#define GPX_ELEM_TYPE_DESC 8 -#define GPX_ELEM_TYPE_SRC 9 - -struct gpxpt -{ - double lat; - double lon; - double elevation; - char use_elevation; - char * name; - char * desc; - // This is the MS Map symbol. - // FIXME Actually, MS Map symbol varies between versions, - // so this should be an invariant id. - int symbol; - char* url; - char* urlname; - // more later -}; - -struct gpxpt * gpxpt_new(); -void gpxpt_delete(struct gpxpt * pt); -struct gpxpt * gpxpt_copy(struct gpxpt * otherpt); - -struct gpxrte -{ - char* name; - struct gpxpt** rtept_list; - int rtept_list_count; -}; - -struct gpxrte * gpxrte_new(); -void gpxrte_delete(struct gpxrte * rte); - -struct gpxtrk -{ - struct gpxpt** trkpt_list; - int trkpt_list_count; -} ; - -struct gpxtrk * gpxtrk_new(); -void gpxtrk_delete(struct gpxtrk * trk); - -struct gpx_data -{ - char* data_source_name; - struct gpxpt ** wpt_list; - int wpt_list_count; - struct gpxrte ** rte_list; - int rte_list_count; - struct gpxtrk ** trk_list; - int trk_list_count; -}; - -struct gpx_data * gpx_data_new(); -void gpx_data_delete(struct gpx_data * data); - -struct gpxpt * find_matching_wpt(struct gpx_data * dat, char* name); - -struct gpx_data * process_gpx_in_file(char* gpx_in_file_name); -void print_gpx_data(struct gpx_data * all_data); - -// FIXME is this the correct way to forward define these? -#ifndef __cplusplus -extern struct pushpin_safelist; -extern struct journey; -extern struct annotations; -#endif // __cplusplus - -void gpx_write_all(char* gpx_out_file_name, - struct pushpin_safelist *ppplist, - struct journey * jour, - struct annotations * annots); - -#ifdef __cplusplus -} -#endif diff --git a/st2gpx/src/history.txt b/st2gpx/src/history.txt deleted file mode 100644 index 02ff0216f..000000000 --- a/st2gpx/src/history.txt +++ /dev/null @@ -1,40 +0,0 @@ -History: - -This app started out as ansi C using gcc as an app to explore the .axe file format, -and with the intention of fitting into the GPSBabel ansi C requirement. - -The pushpin data (UserData) required MS Jet libraries, initially this was done -with ADO in VB, then in C++ using MS #import. Note that the ADO type libraries -do not support C via #import, and I was not game to even try direct OLE access to the -ADO libraries via COM. - -So now there is an ugly mix of C/C++ in an app that grew organically rather than being designed. -It probably could be implemented a lot cleaner in c++ and with some inteligent use of streams -etc. - -Yeah, ok, I am just an amateur at this... - -18-10-2003 look mum! I can open an axe files into OLE storage streams using various tools. -21-10-2003 annotations stream dump -27-10-2003 journey & pushpins export using VB module - 8-11-2003 match journey route-points to pushpins, - integrate parts into single C/C++ exe (except istorage) - 9-11-2003 fixed invalid gpx. -10-11-2003 gpx import working for routes/tracks to s&t annotation lines. -13-11-2003 export as pcx5 for import into Garmin MapSource, - import from Garmin MapSource text export format -20-11-2003 substantial cleanup - fixed 8byte alignment in properties.c - introduced 1byte alignment for journey analysis - understands most journey options -22-11-2003 explores UDM data -28-11-2003 imports pushpins - imports lines to v3 annotations (2002+) - 5-12-2003 imports/exports symbols, with custom GPX symbol names -11-12-2003 support lines with text (e.g. drive-time regions) - translate closed-polygons for import/export - export circles & ovals - support long pushpin notes - import groundspeak types with different symbols - various minor fixes - general clean-up diff --git a/st2gpx/src/istorage license.txt b/st2gpx/src/istorage license.txt deleted file mode 100644 index fde84dffe..000000000 --- a/st2gpx/src/istorage license.txt +++ /dev/null @@ -1,24 +0,0 @@ -Copyright (c) 2001, Pabs (pabs3@zip.to) -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: - -Redistributions of source code must retain the above copyright notice, -this list of conditions and the following disclaimer. -Redistributions in binary form must reproduce the above copyright -notice, this list of conditions and the following disclaimer in the -documentation and/or other materials provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file diff --git a/st2gpx/src/istorage-make license.txt b/st2gpx/src/istorage-make license.txt deleted file mode 100644 index 5ee1421bf..000000000 --- a/st2gpx/src/istorage-make license.txt +++ /dev/null @@ -1,24 +0,0 @@ -Copyright (c) 2002, Pabs (pabs3@zip.to) -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: - -Redistributions of source code must retain the above copyright notice, -this list of conditions and the following disclaimer. -Redistributions in binary form must reproduce the above copyright -notice, this list of conditions and the following disclaimer in the -documentation and/or other materials provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file diff --git a/st2gpx/src/journey.c b/st2gpx/src/journey.c deleted file mode 100644 index da2b612d3..000000000 --- a/st2gpx/src/journey.c +++ /dev/null @@ -1,448 +0,0 @@ -/* - journey.c - - Extract data from MS Streets & Trips .est, Autoroute .axe - and Mapoint .ptm files in GPX format. - - Copyright (C) 2003 James Sherring, james_sherring@yahoo.com - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111 USA - - - This app depends on istorage & istorage-make from Pabs (pabs3@zip.to) - and James Clark's Expat xml parser from http://www.libexpat.org/. - -*/ - -#include -#include -#include -#include -#include -#include - -#include "gpx.h" -#include "st2gpx.h" -#include "pushpins.h" -#include "ppinutil.h" -#include "journey.h" - -#ifdef EXPLORE -#include "explore.h" -#endif - -float scaled2deg(int scaled_deg) -// there must be a simple single line calc -{ - double x=scaled_deg; - x = x*360/0x10000; - x = x/0x10000; - return (float)x; -} - -void jour_rtept_init(struct jour_rtept * nw) -{ -// struct jour_rtept_rec * nw=(struct jour_rtept_rec*)xmalloc(sizeof(struct jour_rtept_rec)); - nw->pthead_os=0; - nw->text1=NULL; - nw->ptmid_os=0; - nw->text2=NULL; - nw->pttail_os=0; - // pointer to pushpin owned by pushpinlist - nw->pushpin=NULL; - strcpy(nw->garmin_ident," "); -} - -void jour_rtept_delete(struct jour_rtept * jourpt) -{ - if (jourpt==NULL) - return; - free(jourpt->text1); - free(jourpt->text2); - // This is part of an array, so free the array - //free(jourpt); -} - -struct journey * journey_new() -{ - struct journey * nw = (struct journey*)xmalloc(sizeof(struct journey)); - nw->buf_len=0; - nw->buf=NULL; - - nw->count_rtepts=0; - nw->rtept_list=NULL; - nw->jopts_os=0; - nw->jopts_eur8_os=0; - nw->jopts_usa8_os=0; - nw->jopts_usa10_os=0; - nw->count_avoid_regions=0; - nw->avoid_os_list=NULL; - nw->trailer_os=0; - return nw; -} - -void journey_delete(struct journey * jour) -{ - int i; - if (jour==NULL) - return; - for(i=0; i< jour->count_rtepts; i++) - jour_rtept_delete(jour->rtept_list + i); - free(jour->rtept_list); - free(jour->avoid_os_list); - free(jour->buf); - free(jour); -} - - -struct journey * process_journey_stream (char* jour_in_file_name, - struct pushpin_safelist * ppplist) -{ - int j; - int readbyte; - int bytes2read=0; - - int max_read_more = 10000; - int readmore=0; - int status; - char readmorebuf[10000]; - - int UdId; -// double lat; -// double lon; -// double x; -// double y; -// double z; - - struct journey * jour = journey_new(); -// struct jour_rtept * thispt=NULL; - FILE* jour_in_file=NULL; - struct f_jour_pt_head * pt_head=NULL; - struct f_jour_opts_EUR_8* opts_eur8; - struct f_jour_opts_EUR_10* opts_eur10; - struct f_jour_opts_USA_8* opts_usa8; - struct f_jour_opts_USA_10* opts_usa10; - - if (opts.verbose_flag>2) - printf("Processing Journey stream\n"); - - if ((jour_in_file = fopen(jour_in_file_name, "rb")) == NULL) - { - fprintf(stderr, "Quitting because I cannot open %s\n", jour_in_file_name); - debug_pause(); - exit(1); - } - - bytes2read=sizeof(struct f_jour_header); - jour->buf=(char*)xmalloc(jour->buf_len+bytes2read); - status = readbytes(jour_in_file, jour->buf, bytes2read); - jour->buf_len += bytes2read; - if (status!=bytes2read) - { - printf("Unexpected EOF in the Journey stream header\n"); - fclose(jour_in_file); - return jour; - } - jour->header_os = 0; - jour->count_rtepts = ((struct f_jour_header*)(jour->buf + jour->header_os))->cpoints; - - printf("got Journey file header with %d waypoints\n", jour->count_rtepts); - debug_pause(); - - // an array of jour_rtept - jour->rtept_list = (struct jour_rtept *)xmalloc( - jour->count_rtepts*sizeof(struct jour_rtept)); - - for (j=0; j< jour->count_rtepts; j++) - { - jour_rtept_init(jour->rtept_list + j); - - // read pt header - bytes2read=sizeof(struct f_jour_pt_head); - jour->buf=(char*)xrealloc(jour->buf, jour->buf_len+bytes2read); - status = readbytes(jour_in_file, jour->buf + jour->buf_len, bytes2read); - if (status!=bytes2read) - { - printf("Unexpected EOF in the Journey stream, routepoint %d\n", j); - fclose(jour_in_file); - return jour; - } - jour->rtept_list[j].pthead_os=jour->buf_len; - jour->buf_len += bytes2read; - - // read pt text1 - bytes2read=((struct f_jour_pt_head*) - (jour->buf + jour->rtept_list[j].pthead_os))->cbtext1; - if (bytes2read) - { - jour->buf=(char*)xrealloc(jour->buf, jour->buf_len+bytes2read); - status = readbytes(jour_in_file, jour->buf + jour->buf_len, bytes2read); - if (status!=bytes2read) - { - printf("Unexpected EOF in the Journey stream, routepoint %d\n", j); - fclose(jour_in_file); - return jour; - } - jour->rtept_list[j].text1= (char*)malloc(bytes2read+1); - memcpy(jour->rtept_list[j].text1, jour->buf + jour->buf_len, bytes2read); - jour->rtept_list[j].text1[bytes2read]=0; - jour->buf_len += bytes2read; - - str2ascii(jour->rtept_list[j].text1); - } - - // read pt middle - bytes2read=sizeof(struct f_jour_pt_mid); - jour->buf=(char*)xrealloc(jour->buf, jour->buf_len+bytes2read); - status = readbytes(jour_in_file, jour->buf + jour->buf_len, bytes2read); - if (status!=bytes2read) - { - printf("Unexpected EOF in the Journey stream, routepoint %d\n", j); - fclose(jour_in_file); - return jour; - } - jour->rtept_list[j].ptmid_os=jour->buf_len; - jour->buf_len += bytes2read; - - // read pt text2 - bytes2read=2*(((struct f_jour_pt_mid*)(jour->buf+jour->rtept_list[j].ptmid_os))->cbtext2); - if (bytes2read) - { - jour->buf=(char*)xrealloc(jour->buf, jour->buf_len+bytes2read); - status = readbytes(jour_in_file, jour->buf + jour->buf_len, bytes2read); - if (status!=bytes2read) - { - printf("Unexpected EOF in the Journey stream, routepoint %d\n", j); - fclose(jour_in_file); - return jour; - } - jour->rtept_list[j].text2= (char*)malloc(bytes2read+2); - memcpy(jour->rtept_list[j].text2, jour->buf + jour->buf_len, bytes2read); - jour->rtept_list[j].text2[bytes2read]=0; - jour->rtept_list[j].text2[bytes2read+1]=0; - jour->buf_len += bytes2read; - } - - // read pt tail - bytes2read=sizeof(struct f_jour_pt_tail); - jour->buf=(char*)xrealloc(jour->buf, jour->buf_len+bytes2read); - status = readbytes(jour_in_file, jour->buf + jour->buf_len, bytes2read); - if (status!=bytes2read) - { - printf("Unexpected EOF in the Journey stream, routepoint %d\n", j); - fclose(jour_in_file); - return jour; - } - jour->rtept_list[j].pttail_os=jour->buf_len; - jour->buf_len += bytes2read; - - pt_head = (struct f_jour_pt_head*)(jour->buf+jour->rtept_list[j].pthead_os); -// UdId= ((struct f_jour_pt_head*)(jour->buf+jour->rtept_list[j].pthead_os))->UdId; - UdId = pt_head->UdId; - jour->rtept_list[j].pushpin = ppin_by_UdId(UdId, ppplist); - - if (jour->rtept_list[j].pushpin != NULL) - { - if (opts.verbose_flag > 5) - { - printf("Found matching pushpin:\n"); - printf("Pushpin name is: %s\n", jour->rtept_list[j].pushpin->UdName); - printf("Pushpin short note is: %s\n", jour->rtept_list[j].pushpin->NoteShort); - } -/* if (opts.verbose_flag > 4) - { - lat=jour->rtept_list[j].pushpin->lat; - lon=jour->rtept_list[j].pushpin->lon; - - printf("Matching pushpin Grid %#x=%d, Precision %#x=%d, MOBBId %#x=%d\n", - jour->rtept_list[j].pushpin->Grid, - jour->rtept_list[j].pushpin->Grid, - jour->rtept_list[j].pushpin->Precision, - jour->rtept_list[j].pushpin->Precision, - jour->rtept_list[j].pushpin->MOBBId, - jour->rtept_list[j].pushpin->MOBBId); - - printf("Matching pushpin Lat %f Lon %f\n", - jour->rtept_list[j].pushpin->lat, - jour->rtept_list[j].pushpin->lon); - - x = cos(lon*M_PI/180)*cos(lat*M_PI/180); - y = sin(lon*M_PI/180)*cos(lat*M_PI/180); - z = sin(lat*M_PI/180); - - printf("For matching pushpin X=%f Y=%f Z=%f\n", x,y,z); - } -*/ - } -/* else - { - printf("*** Warning *** Ignoring route point '%s' without matching pushpin\n", - jour->rtept_list[j].text1); - printf("(yes, I should do someting more clever than this).\n"); - if (UdId) - printf("There should have been a matching pushin because UdId=%d\n", UdId); - } -*/ - } - - // read jour generic opts - bytes2read=sizeof(struct f_jour_opts); - jour->buf=(char*)xrealloc(jour->buf, jour->buf_len+bytes2read); - status = readbytes(jour_in_file, jour->buf + jour->buf_len, bytes2read); - if (status!=bytes2read) - { - printf("Unexpected EOF in the Journey stream, options\n"); - fclose(jour_in_file); - return jour; - } - jour->jopts_os=jour->buf_len; - jour->buf_len += bytes2read; - - // read file-version specific journey options - if( (opts.st_version_num==8) && (opts.isUSA==0)) - { - bytes2read=sizeof(struct f_jour_opts_EUR_8); - jour->buf=(char*)xrealloc(jour->buf, jour->buf_len+bytes2read); - status = readbytes(jour_in_file, jour->buf + jour->buf_len, bytes2read); - if (status!=bytes2read) - { - printf("Unexpected EOF in the Journey stream, options eur8\n"); - fclose(jour_in_file); - return jour; - } - jour->jopts_eur8_os=jour->buf_len; - jour->buf_len += bytes2read; - opts_eur8=(struct f_jour_opts_EUR_8*)(jour->buf + jour->jopts_eur8_os); - jour->count_avoid_regions = opts_eur8->count_avoid_regions; - } - else if( ( (opts.st_version_num==10) && (opts.isUSA==0) ) - || ( (opts.st_version_num==9) ) - || ( (opts.st_version_num==11) )) - { - bytes2read=sizeof(struct f_jour_opts_EUR_10); - jour->buf=(char*)xrealloc(jour->buf, jour->buf_len+bytes2read); - status = readbytes(jour_in_file, jour->buf + jour->buf_len, bytes2read); - if (status!=bytes2read) - { - printf("Unexpected EOF in the Journey stream, options eur10\n"); - fclose(jour_in_file); - return jour; - } - jour->jopts_eur10_os=jour->buf_len; - jour->buf_len += bytes2read; - opts_eur10=(struct f_jour_opts_EUR_10*)(jour->buf + jour->jopts_eur10_os); - jour->count_avoid_regions = opts_eur10->count_avoid_regions; - } - else if( (opts.st_version_num==8) && (opts.isUSA) ) - { - bytes2read=sizeof(struct f_jour_opts_USA_8); - jour->buf=(char*)xrealloc(jour->buf, jour->buf_len+bytes2read); - status = readbytes(jour_in_file, jour->buf + jour->buf_len, bytes2read); - if (status!=bytes2read) - { - printf("Unexpected EOF in the Journey stream, options usa8\n"); - fclose(jour_in_file); - return jour; - } - jour->jopts_usa8_os=jour->buf_len; - jour->buf_len += bytes2read; - opts_usa8=(struct f_jour_opts_USA_8*)(jour->buf + jour->jopts_usa8_os); - jour->count_avoid_regions = opts_usa8->count_avoid_regions; - } - else if((opts.st_version_num==10) && (opts.isUSA) ) - { - bytes2read=sizeof(struct f_jour_opts_USA_10); - jour->buf=(char*)xrealloc(jour->buf, jour->buf_len+bytes2read); - status = readbytes(jour_in_file, jour->buf + jour->buf_len, bytes2read); - if (status!=bytes2read) - { - printf("Unexpected EOF in the Journey stream, options usa10\n"); - fclose(jour_in_file); - return jour; - } - jour->jopts_usa10_os=jour->buf_len; - jour->buf_len += bytes2read; - opts_usa10=(struct f_jour_opts_USA_10*)(jour->buf + jour->jopts_usa10_os); - jour->count_avoid_regions = opts_usa10->count_avoid_regions; - } - else - printf("I dont yet understand the structure of the Journey options for this file version.\n"); - - if (jour->count_avoid_regions >0) - { - printf("Reading %d avoid regions", jour->count_avoid_regions); - - // an array of pointers to f_jour_avoid - jour->avoid_os_list=(int*)xmalloc((jour->count_avoid_regions)*sizeof(int)); - - for (j=0; j< jour->count_avoid_regions; j++) - { - // read avoid record - bytes2read=sizeof(struct f_jour_avoid); - jour->buf=(char*)xrealloc(jour->buf, jour->buf_len+bytes2read); - status = readbytes(jour_in_file, jour->buf + jour->buf_len, bytes2read); - if (status!=bytes2read) - { - printf("Unexpected EOF in the Journey stream, avoid record %d\n", j); - fclose(jour_in_file); - return jour; - } - jour->avoid_os_list[j]= jour->buf_len; - jour->buf_len += bytes2read; - } - } - - // read journey tail - bytes2read=sizeof(struct f_jour_trailer); - jour->buf=(char*)xrealloc(jour->buf, jour->buf_len+bytes2read); - status = readbytes(jour_in_file, jour->buf + jour->buf_len, bytes2read); - if (status!=bytes2read) - { - printf("Unexpected EOF in the Journey stream, trailer\n"); - fclose(jour_in_file); - return jour; - } - jour->trailer_os=jour->buf_len; - jour->buf_len += bytes2read; - - readmore=0; - if ((readbyte = getc(jour_in_file))!=EOF) - { - fprintf (stderr, "Did not finish reading journey file at EOF\n"); - - do { - readmorebuf[readmore]=(char)readbyte; - readmore++; - if (readmore>max_read_more) - break; - } while ((readbyte = getc(jour_in_file))!=EOF); - - printf("read a further %d bytes past expected eof\n", readmore); - printbuf(readmorebuf, readmore); - } - - fclose(jour_in_file); - - if (opts.verbose_flag>2) - printf("Finished processing Journey stream.\n"); - fflush(stdout); - -#ifdef EXPLORE - if (opts.explore_flag) - print_journey(jour); -#endif - - return jour; -} diff --git a/st2gpx/src/journey.h b/st2gpx/src/journey.h deleted file mode 100644 index f750cde49..000000000 --- a/st2gpx/src/journey.h +++ /dev/null @@ -1,387 +0,0 @@ -/* - journey.h - - Extract data from MS Streets & Trips .est, Autoroute .axe - and Mapoint .ptm files in GPX format. - - Copyright (C) 2003 James Sherring, james_sherring@yahoo.com - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111 USA - - - This app depends on istorage & istorage-make from Pabs (pabs3@zip.to) - and James Clark's Expat xml parser from http://www.libexpat.org/. - -*/ -#ifdef __cplusplus -extern "C" { -#endif - -#define JOUR_FILE_HEAD_LEN 32 -#define JOUR_FILE_TAIL_LEN_EUR_V8 430 -#define JOUR_FILE_TAIL_LEN_USA_V8 426 -#define JOUR_FILE_TAIL_LEN_USA_V10 396 - -// + text1 +2*text2 -#define JOUR_WPTREC_LEN 121 - -#define JOUR_FILE_OS_NUMREC 16 - -#define JOURWPT_REC_HEAD_LEN 41 - -#define JOURWPT_RECOS_WPTNUM 0 -#define JOURWPT_RECOS_STR1LEN 40 -#define JOURWPT_RECOS_STR1 41 -// + val(JOURWPT_RECOS_STR1LEN) -#define JOURWPT_RECOS_STR2LEN 44 -#define JOURWPT_RECOS_STR2 45 - -// Still to test in Journey: -// * points located by address Vs by mouse Vs by pushpin -// * avoid areas -// * drag route -struct f_jour_header -{ - int iunkn0; - int iunkn1; - int iunkn2; - int iunkn3; - unsigned int cpoints; - int iunkn4; - int iunkn5; - int iunkn6; -}; - -struct f_jour_pt_head -{ - // DB prim key for pushpin - // 0 if no pushpin - int UdId; - int stop_dur_secs; - int iunkn0; - int sched_arrive_flag; - // This may have more meaning, - // it changes with small changes in route. - // Perhaps just small changes in route time? - int sched_depart_flag; - int arrive_time_secs; - int depart_time_secs; - int iunkn1; - // The coords for the actual journey point, not neccessarily on a road. - //ie =lat/360*2^32 - int scaled_lon; - int scaled_lat; - unsigned char cbtext1; -}; - -// then jour_pt_head.cbtext1 bytes of text - -struct f_jour_pt_mid -{ - // this just seems to be a const FF FE FF - char mid_tag[3]; - unsigned char cbtext2; -}; - -// then 2*jour_pt_mid.cbtext2 bytes of wide text - -struct f_jour_pt_tail -{ - // 0=fastest - // 1=shortest - // 2=prefered - // (from previous jour_pt) - int route_rd_pref; // =0 - // these seem const - int iunkn0; // = 1 - int iunkn1; // = 4 - int iunkn2; // =0 - int iunkn3; // =1 - int road_id; - double dist_along_rd_frac; - // The coords for the arrival point on the road - //ie =lat/360*2^32 - int rd_arrive_sc_lat; - int rd_arrive_sc_lon; - // The coords for the departure point on the road - int rd_depart_sc_lat; - int rd_depart_sc_lon; - int iunkn8; // 4 - int iunkn9; // 1 - int iunkn10; // 1 - int iunkn11; // 6 - int iunkn12; // 1 - int iunkn13; // 1 - // ? size ? - int iunkn14; // 30 -} ; - -struct f_jour_opts -{ - // @00 - short int siunkn0; - float funkn0; - double toll_rd_pref; - double motorway_pref; // ok - // @16 - double major_rd_pref; - double minor_rd_pref; - // @26 - double ferry_pref; - int iunkn0; - // @32 - int iunkn1; - int iunkn2; - double fuel_price; // ok - // @42 - // 3 = per US Gallon - int iunkn3; - int fuel_price_unit; - int iunkn4; - double tank_capacity; // ok - // @56 - // 2 = liters - int tank_capacity_units; - double tank_start_level; // ok - // @62 - double tank_warn_level; // ok - int iunkn5; - double fuel_use_city; // ok - // @76 - // 3 = liters/100k - int fuel_use_city_unit; - int iunkn6; - double fuel_use_mway; //ok - // @86 - // 3 = liters/100k - int fuel_use_mway_unit; - int iunkn7; - double mway_speed; //ok - // @96 - int mway_speed_unit; - int iunkn9; - double lim_acc_speed; //ok - // @a6 - int lim_acc_speed_unit; - int iunkn11; - double maj_rd_speed; //ok - // @b6 - int maj_rd_speed_unit; - int iunkn13; - double min_rd_speed; //ok - // @c6 - int min_rd_speed_unit; - int iunkn15; - double street_speed; //ok - // @d6 - int street_speed_unit; - int iunkn17; - int iunkn18; - float funkn1; - // @e6 - int iunkn19; - int iunkn20; - int iunkn21; - float funkn2; - // @f6 - int iunkn22; - int iunkn23; - int iunkn24; - float funkn3; - // @106 - int iunkn25; - int iunkn26; - int iunkn27; - float funkn4; - // @116 - int iunkn28; - int iunkn29; - int iunkn30; - float funkn5; - // @126 - int iunkn31; - int iunkn32; - int iunkn33; - int start_drv_hr; //ok - // @136 - int start_drv_min; //ok - int iunkn34; - int end_drv_hr; //ok - int end_drv_min; //ok - // @146 - int fuel_warn_flag; - int iunkn35; - int fuel_fixed_rate_flag; - int iunkn36; - // @156 - int fuel_cost_dist; - int route_flex_secs; //ok - int iunkn37; - int rest_flag; - // @166 - int rest_dur_secs; - int rest_interval_secs; -} ; - -// 56 bytes - struct f_jour_opts_EUR_8 -{ - int iunkn38; - int iunkn39; - // @176 - int iunkn40; - int iunkn41; - int iunkn42; - short int siunkn1; - // @184 - int route_show_tm; - int route_show_dist; - int route_show_inst; - // @190 - int route_show_for; - int route_show_to; - int route_show_font_size; - int iunkn43; - // @1a0 - // not in usa version8 - int iunkn44; - unsigned short int count_avoid_regions; -} ; - -// 22 bytes -// Also works for USA9 and USA11 - and EUR9, EUR11 -struct f_jour_opts_EUR_10 -{ - int iunkn38; - int iunkn39; - // @176 - int iunkn40; - int iunkn41; - int iunkn42; - - unsigned short int count_avoid_regions; -}; - -// 52 bytes -struct f_jour_opts_USA_8 -{ - int iunkn38; - int iunkn39; - // @176 - int iunkn40; - int iunkn41; - int iunkn42; - short int siunkn1; - // @184 - int iunkn43; - int iunkn44; - int iunkn45; - // @190 - int iunkn46; - int iunkn47; - int iunkn48; - int iunkn49; - // @1a0 - unsigned short int count_avoid_regions; -}; - -// 32 bytes -struct f_jour_opts_USA_10 -{ - int iunkn38; - int iunkn39; - // @176 - int iunkn40; - int iunkn41; - int iunkn42; - short int siunkn1; - // @184 - int iunkn43; - int iunkn44; - unsigned short int count_avoid_regions; -}; - - -struct f_jour_avoid -{ - float x; - float y; - float z; - int iunkn0; - int iunkn1; - int iunkn2; - int iunkn3; - int iunkn4; - int iunkn5; - // avoid num? annot? - int annot_num; -}; - - -struct f_jour_trailer -{ - int iunkn0; // =0x65 - int iunkn1; -}; - -struct jour_rtept -{ - int pthead_os; - // mem owned by this struct, as buf does not have terminating null - char* text1; - int ptmid_os; - // mem owned by this struct, as buf does not have terminating null - char* text2; - int pttail_os; - // pointer to pushpin owned by pushpinlist - struct pushpin* pushpin; - char garmin_ident[7]; -}; - -struct jour_rtept_rec * jour_rtept_rec_new(); -void jour_rtept_rec_delete(struct jour_rtept_rec * jourpt_rec); - -struct journey -{ - int buf_len; - char* buf; - // We need to use nasty unsigned shorts if we compare to ->header->cpoints - int count_rtepts; - // a convenience for looking in multiple version opts - int count_avoid_regions; - int header_os; - // an array of jour_rtept - struct jour_rtept * rtept_list; - int jopts_os; - int jopts_eur8_os; - int jopts_eur10_os; - int jopts_usa8_os; - int jopts_usa10_os; - // an array of ofsets to f_jour_avoid - int * avoid_os_list; - int trailer_os; -}; - -float scaled2deg(int scaled_deg); - -struct journey * journey_new(); -void journey_delete(struct journey * jour); - -struct journey * process_journey_stream (char* jour_in_file_name, struct pushpin_safelist * ppplist); - - -#ifdef __cplusplus -} -#endif diff --git a/st2gpx/src/msado15.tlh b/st2gpx/src/msado15.tlh deleted file mode 100644 index b49246411..000000000 --- a/st2gpx/src/msado15.tlh +++ /dev/null @@ -1,2997 +0,0 @@ -// Created by Microsoft (R) C/C++ Compiler Version 12.00.8168.0 (1f62c7b3). -// -// msado15.tlh -// -// C++ source equivalent of Win32 type library msado15.dll -// compiler-generated file created 11/21/03 at 18:38:05 - DO NOT EDIT! - -#pragma once -#pragma pack(push, 8) - -#include - -namespace ADODB { - -// -// Forward references and typedefs -// - -typedef enum SearchDirectionEnum SearchDirection; -struct __declspec(uuid("00000512-0000-0010-8000-00aa006d2ea4")) -/* dual interface */ _Collection; -struct __declspec(uuid("00000513-0000-0010-8000-00aa006d2ea4")) -/* dual interface */ _DynaCollection; -struct __declspec(uuid("00000534-0000-0010-8000-00aa006d2ea4")) -/* dual interface */ _ADO; -struct __declspec(uuid("00000504-0000-0010-8000-00aa006d2ea4")) -/* dual interface */ Properties; -struct __declspec(uuid("00000503-0000-0010-8000-00aa006d2ea4")) -/* dual interface */ Property; -struct __declspec(uuid("00000500-0000-0010-8000-00aa006d2ea4")) -/* dual interface */ Error; -struct __declspec(uuid("00000501-0000-0010-8000-00aa006d2ea4")) -/* dual interface */ Errors; -struct __declspec(uuid("00000508-0000-0010-8000-00aa006d2ea4")) -/* dual interface */ Command15; -struct __declspec(uuid("00000550-0000-0010-8000-00aa006d2ea4")) -/* dual interface */ _Connection; -struct __declspec(uuid("00000515-0000-0010-8000-00aa006d2ea4")) -/* dual interface */ Connection15; -struct __declspec(uuid("00000556-0000-0010-8000-00aa006d2ea4")) -/* dual interface */ _Recordset; -struct __declspec(uuid("00000555-0000-0010-8000-00aa006d2ea4")) -/* dual interface */ Recordset21; -struct __declspec(uuid("0000054f-0000-0010-8000-00aa006d2ea4")) -/* dual interface */ Recordset20; -struct __declspec(uuid("0000050e-0000-0010-8000-00aa006d2ea4")) -/* dual interface */ Recordset15; -struct __declspec(uuid("00000564-0000-0010-8000-00aa006d2ea4")) -/* dual interface */ Fields; -struct __declspec(uuid("0000054d-0000-0010-8000-00aa006d2ea4")) -/* dual interface */ Fields20; -struct __declspec(uuid("00000506-0000-0010-8000-00aa006d2ea4")) -/* dual interface */ Fields15; -struct __declspec(uuid("00000569-0000-0010-8000-00aa006d2ea4")) -/* dual interface */ Field; -struct __declspec(uuid("0000054c-0000-0010-8000-00aa006d2ea4")) -/* dual interface */ Field20; -struct __declspec(uuid("0000050c-0000-0010-8000-00aa006d2ea4")) -/* dual interface */ _Parameter; -struct __declspec(uuid("0000050d-0000-0010-8000-00aa006d2ea4")) -/* dual interface */ Parameters; -struct __declspec(uuid("0000054e-0000-0010-8000-00aa006d2ea4")) -/* dual interface */ _Command; -struct __declspec(uuid("00000402-0000-0010-8000-00aa006d2ea4")) -/* interface */ ConnectionEventsVt; -struct __declspec(uuid("00000403-0000-0010-8000-00aa006d2ea4")) -/* interface */ RecordsetEventsVt; -struct __declspec(uuid("00000400-0000-0010-8000-00aa006d2ea4")) -/* dispinterface */ ConnectionEvents; -struct __declspec(uuid("00000266-0000-0010-8000-00aa006d2ea4")) -/* dispinterface */ RecordsetEvents; -struct __declspec(uuid("00000516-0000-0010-8000-00aa006d2ea4")) -/* interface */ ADOConnectionConstruction15; -struct __declspec(uuid("00000551-0000-0010-8000-00aa006d2ea4")) -/* interface */ ADOConnectionConstruction; -struct /* coclass */ Connection; -struct __declspec(uuid("00000562-0000-0010-8000-00aa006d2ea4")) -/* dual interface */ _Record; -struct /* coclass */ Record; -struct __declspec(uuid("00000563-0000-0010-8000-00aa006d2ea4")) -/* dual interface */ IRecFields; -struct __declspec(uuid("00000565-0000-0010-8000-00aa006d2ea4")) -/* dual interface */ _Stream; -struct /* coclass */ Stream; -struct __declspec(uuid("00000567-0000-0010-8000-00aa006d2ea4")) -/* interface */ ADORecordConstruction; -struct __declspec(uuid("00000568-0000-0010-8000-00aa006d2ea4")) -/* interface */ ADOStreamConstruction; -struct __declspec(uuid("00000517-0000-0010-8000-00aa006d2ea4")) -/* interface */ ADOCommandConstruction; -struct /* coclass */ Command; -struct /* coclass */ Recordset; -struct __declspec(uuid("00000283-0000-0010-8000-00aa006d2ea4")) -/* interface */ ADORecordsetConstruction; -struct __declspec(uuid("00000505-0000-0010-8000-00aa006d2ea4")) -/* dual interface */ Field15; -struct /* coclass */ Parameter; - -// -// Smart pointer typedef declarations -// - -_COM_SMARTPTR_TYPEDEF(_Collection, __uuidof(_Collection)); -_COM_SMARTPTR_TYPEDEF(_DynaCollection, __uuidof(_DynaCollection)); -_COM_SMARTPTR_TYPEDEF(_ADO, __uuidof(_ADO)); -_COM_SMARTPTR_TYPEDEF(Properties, __uuidof(Properties)); -_COM_SMARTPTR_TYPEDEF(Property, __uuidof(Property)); -_COM_SMARTPTR_TYPEDEF(Error, __uuidof(Error)); -_COM_SMARTPTR_TYPEDEF(Errors, __uuidof(Errors)); -_COM_SMARTPTR_TYPEDEF(Command15, __uuidof(Command15)); -_COM_SMARTPTR_TYPEDEF(Connection15, __uuidof(Connection15)); -_COM_SMARTPTR_TYPEDEF(_Connection, __uuidof(_Connection)); -_COM_SMARTPTR_TYPEDEF(Recordset15, __uuidof(Recordset15)); -_COM_SMARTPTR_TYPEDEF(Recordset20, __uuidof(Recordset20)); -_COM_SMARTPTR_TYPEDEF(Recordset21, __uuidof(Recordset21)); -_COM_SMARTPTR_TYPEDEF(_Recordset, __uuidof(_Recordset)); -_COM_SMARTPTR_TYPEDEF(Fields15, __uuidof(Fields15)); -_COM_SMARTPTR_TYPEDEF(Fields20, __uuidof(Fields20)); -_COM_SMARTPTR_TYPEDEF(Fields, __uuidof(Fields)); -_COM_SMARTPTR_TYPEDEF(Field20, __uuidof(Field20)); -_COM_SMARTPTR_TYPEDEF(Field, __uuidof(Field)); -_COM_SMARTPTR_TYPEDEF(_Parameter, __uuidof(_Parameter)); -_COM_SMARTPTR_TYPEDEF(Parameters, __uuidof(Parameters)); -_COM_SMARTPTR_TYPEDEF(_Command, __uuidof(_Command)); -_COM_SMARTPTR_TYPEDEF(ConnectionEventsVt, __uuidof(ConnectionEventsVt)); -_COM_SMARTPTR_TYPEDEF(RecordsetEventsVt, __uuidof(RecordsetEventsVt)); -_COM_SMARTPTR_TYPEDEF(ConnectionEvents, __uuidof(IDispatch)); -_COM_SMARTPTR_TYPEDEF(RecordsetEvents, __uuidof(IDispatch)); -_COM_SMARTPTR_TYPEDEF(ADOConnectionConstruction15, __uuidof(ADOConnectionConstruction15)); -_COM_SMARTPTR_TYPEDEF(ADOConnectionConstruction, __uuidof(ADOConnectionConstruction)); -_COM_SMARTPTR_TYPEDEF(_Record, __uuidof(_Record)); -_COM_SMARTPTR_TYPEDEF(IRecFields, __uuidof(IRecFields)); -_COM_SMARTPTR_TYPEDEF(_Stream, __uuidof(_Stream)); -_COM_SMARTPTR_TYPEDEF(ADORecordConstruction, __uuidof(ADORecordConstruction)); -_COM_SMARTPTR_TYPEDEF(ADOStreamConstruction, __uuidof(ADOStreamConstruction)); -_COM_SMARTPTR_TYPEDEF(ADOCommandConstruction, __uuidof(ADOCommandConstruction)); -_COM_SMARTPTR_TYPEDEF(ADORecordsetConstruction, __uuidof(ADORecordsetConstruction)); -_COM_SMARTPTR_TYPEDEF(Field15, __uuidof(Field15)); - -// -// Type library items -// - -enum CursorTypeEnum -{ - adOpenUnspecified = -1, - adOpenForwardOnly = 0, - adOpenKeyset = 1, - adOpenDynamic = 2, - adOpenStatic = 3 -}; - -enum CursorOptionEnum -{ - adHoldRecords = 256, - adMovePrevious = 512, - adAddNew = 16778240, - adDelete = 16779264, - adUpdate = 16809984, - adBookmark = 8192, - adApproxPosition = 16384, - adUpdateBatch = 65536, - adResync = 131072, - adNotify = 262144, - adFind = 524288, - adSeek = 4194304, - adIndex = 8388608 -}; - -enum LockTypeEnum -{ - adLockUnspecified = -1, - adLockReadOnly = 1, - adLockPessimistic = 2, - adLockOptimistic = 3, - adLockBatchOptimistic = 4 -}; - -enum ExecuteOptionEnum -{ - adOptionUnspecified = -1, - adAsyncExecute = 16, - adAsyncFetch = 32, - adAsyncFetchNonBlocking = 64, - adExecuteNoRecords = 128 -}; - -enum ConnectOptionEnum -{ - adConnectUnspecified = -1, - adAsyncConnect = 16 -}; - -enum ObjectStateEnum -{ - adStateClosed = 0, - adStateOpen = 1, - adStateConnecting = 2, - adStateExecuting = 4, - adStateFetching = 8 -}; - -enum CursorLocationEnum -{ - adUseNone = 1, - adUseServer = 2, - adUseClient = 3, - adUseClientBatch = 3 -}; - -enum DataTypeEnum -{ - adEmpty = 0, - adTinyInt = 16, - adSmallInt = 2, - adInteger = 3, - adBigInt = 20, - adUnsignedTinyInt = 17, - adUnsignedSmallInt = 18, - adUnsignedInt = 19, - adUnsignedBigInt = 21, - adSingle = 4, - adDouble = 5, - adCurrency = 6, - adDecimal = 14, - adNumeric = 131, - adBoolean = 11, - adError = 10, - adUserDefined = 132, - adVariant = 12, - adIDispatch = 9, - adIUnknown = 13, - adGUID = 72, - adDate = 7, - adDBDate = 133, - adDBTime = 134, - adDBTimeStamp = 135, - adBSTR = 8, - adChar = 129, - adVarChar = 200, - adLongVarChar = 201, - adWChar = 130, - adVarWChar = 202, - adLongVarWChar = 203, - adBinary = 128, - adVarBinary = 204, - adLongVarBinary = 205, - adChapter = 136, - adFileTime = 64, - adPropVariant = 138, - adVarNumeric = 139, - adArray = 8192 -}; - -enum FieldAttributeEnum -{ - adFldUnspecified = -1, - adFldMayDefer = 2, - adFldUpdatable = 4, - adFldUnknownUpdatable = 8, - adFldFixed = 16, - adFldIsNullable = 32, - adFldMayBeNull = 64, - adFldLong = 128, - adFldRowID = 256, - adFldRowVersion = 512, - adFldCacheDeferred = 4096, - adFldIsChapter = 8192, - adFldNegativeScale = 16384, - adFldKeyColumn = 32768, - adFldIsRowURL = 65536, - adFldIsDefaultStream = 131072, - adFldIsCollection = 262144 -}; - -enum EditModeEnum -{ - adEditNone = 0, - adEditInProgress = 1, - adEditAdd = 2, - adEditDelete = 4 -}; - -enum RecordStatusEnum -{ - adRecOK = 0, - adRecNew = 1, - adRecModified = 2, - adRecDeleted = 4, - adRecUnmodified = 8, - adRecInvalid = 16, - adRecMultipleChanges = 64, - adRecPendingChanges = 128, - adRecCanceled = 256, - adRecCantRelease = 1024, - adRecConcurrencyViolation = 2048, - adRecIntegrityViolation = 4096, - adRecMaxChangesExceeded = 8192, - adRecObjectOpen = 16384, - adRecOutOfMemory = 32768, - adRecPermissionDenied = 65536, - adRecSchemaViolation = 131072, - adRecDBDeleted = 262144 -}; - -enum GetRowsOptionEnum -{ - adGetRowsRest = -1 -}; - -enum PositionEnum -{ - adPosUnknown = -1, - adPosBOF = -2, - adPosEOF = -3 -}; - -enum BookmarkEnum -{ - adBookmarkCurrent = 0, - adBookmarkFirst = 1, - adBookmarkLast = 2 -}; - -enum MarshalOptionsEnum -{ - adMarshalAll = 0, - adMarshalModifiedOnly = 1 -}; - -enum AffectEnum -{ - adAffectCurrent = 1, - adAffectGroup = 2, - adAffectAll = 3, - adAffectAllChapters = 4 -}; - -enum ResyncEnum -{ - adResyncUnderlyingValues = 1, - adResyncAllValues = 2 -}; - -enum CompareEnum -{ - adCompareLessThan = 0, - adCompareEqual = 1, - adCompareGreaterThan = 2, - adCompareNotEqual = 3, - adCompareNotComparable = 4 -}; - -enum FilterGroupEnum -{ - adFilterNone = 0, - adFilterPendingRecords = 1, - adFilterAffectedRecords = 2, - adFilterFetchedRecords = 3, - adFilterPredicate = 4, - adFilterConflictingRecords = 5 -}; - -enum SearchDirectionEnum -{ - adSearchForward = 1, - adSearchBackward = -1 -}; - -enum PersistFormatEnum -{ - adPersistADTG = 0, - adPersistXML = 1 -}; - -enum StringFormatEnum -{ - adClipString = 2 -}; - -enum ConnectPromptEnum -{ - adPromptAlways = 1, - adPromptComplete = 2, - adPromptCompleteRequired = 3, - adPromptNever = 4 -}; - -enum ConnectModeEnum -{ - adModeUnknown = 0, - adModeRead = 1, - adModeWrite = 2, - adModeReadWrite = 3, - adModeShareDenyRead = 4, - adModeShareDenyWrite = 8, - adModeShareExclusive = 12, - adModeShareDenyNone = 16, - adModeRecursive = 4194304 -}; - -enum RecordCreateOptionsEnum -{ - adCreateCollection = 8192, - adCreateStructDoc = -2147483648, - adCreateNonCollection = 0, - adOpenIfExists = 33554432, - adCreateOverwrite = 67108864, - adFailIfNotExists = -1 -}; - -enum RecordOpenOptionsEnum -{ - adOpenRecordUnspecified = -1, - adOpenSource = 8388608, - adOpenAsync = 4096, - adDelayFetchStream = 16384, - adDelayFetchFields = 32768 -}; - -enum IsolationLevelEnum -{ - adXactUnspecified = -1, - adXactChaos = 16, - adXactReadUncommitted = 256, - adXactBrowse = 256, - adXactCursorStability = 4096, - adXactReadCommitted = 4096, - adXactRepeatableRead = 65536, - adXactSerializable = 1048576, - adXactIsolated = 1048576 -}; - -enum XactAttributeEnum -{ - adXactCommitRetaining = 131072, - adXactAbortRetaining = 262144, - adXactAsyncPhaseOne = 524288, - adXactSyncPhaseOne = 1048576 -}; - -enum PropertyAttributesEnum -{ - adPropNotSupported = 0, - adPropRequired = 1, - adPropOptional = 2, - adPropRead = 512, - adPropWrite = 1024 -}; - -enum ErrorValueEnum -{ - adErrProviderFailed = 3000, - adErrInvalidArgument = 3001, - adErrOpeningFile = 3002, - adErrReadFile = 3003, - adErrWriteFile = 3004, - adErrNoCurrentRecord = 3021, - adErrIllegalOperation = 3219, - adErrCantChangeProvider = 3220, - adErrInTransaction = 3246, - adErrFeatureNotAvailable = 3251, - adErrItemNotFound = 3265, - adErrObjectInCollection = 3367, - adErrObjectNotSet = 3420, - adErrDataConversion = 3421, - adErrObjectClosed = 3704, - adErrObjectOpen = 3705, - adErrProviderNotFound = 3706, - adErrBoundToCommand = 3707, - adErrInvalidParamInfo = 3708, - adErrInvalidConnection = 3709, - adErrNotReentrant = 3710, - adErrStillExecuting = 3711, - adErrOperationCancelled = 3712, - adErrStillConnecting = 3713, - adErrInvalidTransaction = 3714, - adErrNotExecuting = 3715, - adErrUnsafeOperation = 3716, - adwrnSecurityDialog = 3717, - adwrnSecurityDialogHeader = 3718, - adErrIntegrityViolation = 3719, - adErrPermissionDenied = 3720, - adErrDataOverflow = 3721, - adErrSchemaViolation = 3722, - adErrSignMismatch = 3723, - adErrCantConvertvalue = 3724, - adErrCantCreate = 3725, - adErrColumnNotOnThisRow = 3726, - adErrURLDoesNotExist = 3727, - adErrTreePermissionDenied = 3728, - adErrInvalidURL = 3729, - adErrResourceLocked = 3730, - adErrResourceExists = 3731, - adErrCannotComplete = 3732, - adErrVolumeNotFound = 3733, - adErrOutOfSpace = 3734, - adErrResourceOutOfScope = 3735, - adErrUnavailable = 3736, - adErrURLNamedRowDoesNotExist = 3737, - adErrDelResOutOfScope = 3738, - adErrPropInvalidColumn = 3739, - adErrPropInvalidOption = 3740, - adErrPropInvalidValue = 3741, - adErrPropConflicting = 3742, - adErrPropNotAllSettable = 3743, - adErrPropNotSet = 3744, - adErrPropNotSettable = 3745, - adErrPropNotSupported = 3746, - adErrCatalogNotSet = 3747, - adErrCantChangeConnection = 3748, - adErrFieldsUpdateFailed = 3749, - adErrDenyNotSupported = 3750, - adErrDenyTypeNotSupported = 3751 -}; - -enum ParameterAttributesEnum -{ - adParamSigned = 16, - adParamNullable = 64, - adParamLong = 128 -}; - -enum ParameterDirectionEnum -{ - adParamUnknown = 0, - adParamInput = 1, - adParamOutput = 2, - adParamInputOutput = 3, - adParamReturnValue = 4 -}; - -enum CommandTypeEnum -{ - adCmdUnspecified = -1, - adCmdUnknown = 8, - adCmdText = 1, - adCmdTable = 2, - adCmdStoredProc = 4, - adCmdFile = 256, - adCmdTableDirect = 512 -}; - -enum EventStatusEnum -{ - adStatusOK = 1, - adStatusErrorsOccurred = 2, - adStatusCantDeny = 3, - adStatusCancel = 4, - adStatusUnwantedEvent = 5 -}; - -enum EventReasonEnum -{ - adRsnAddNew = 1, - adRsnDelete = 2, - adRsnUpdate = 3, - adRsnUndoUpdate = 4, - adRsnUndoAddNew = 5, - adRsnUndoDelete = 6, - adRsnRequery = 7, - adRsnResynch = 8, - adRsnClose = 9, - adRsnMove = 10, - adRsnFirstChange = 11, - adRsnMoveFirst = 12, - adRsnMoveNext = 13, - adRsnMovePrevious = 14, - adRsnMoveLast = 15 -}; - -enum SchemaEnum -{ - adSchemaProviderSpecific = -1, - adSchemaAsserts = 0, - adSchemaCatalogs = 1, - adSchemaCharacterSets = 2, - adSchemaCollations = 3, - adSchemaColumns = 4, - adSchemaCheckConstraints = 5, - adSchemaConstraintColumnUsage = 6, - adSchemaConstraintTableUsage = 7, - adSchemaKeyColumnUsage = 8, - adSchemaReferentialContraints = 9, - adSchemaReferentialConstraints = 9, - adSchemaTableConstraints = 10, - adSchemaColumnsDomainUsage = 11, - adSchemaIndexes = 12, - adSchemaColumnPrivileges = 13, - adSchemaTablePrivileges = 14, - adSchemaUsagePrivileges = 15, - adSchemaProcedures = 16, - adSchemaSchemata = 17, - adSchemaSQLLanguages = 18, - adSchemaStatistics = 19, - adSchemaTables = 20, - adSchemaTranslations = 21, - adSchemaProviderTypes = 22, - adSchemaViews = 23, - adSchemaViewColumnUsage = 24, - adSchemaViewTableUsage = 25, - adSchemaProcedureParameters = 26, - adSchemaForeignKeys = 27, - adSchemaPrimaryKeys = 28, - adSchemaProcedureColumns = 29, - adSchemaDBInfoKeywords = 30, - adSchemaDBInfoLiterals = 31, - adSchemaCubes = 32, - adSchemaDimensions = 33, - adSchemaHierarchies = 34, - adSchemaLevels = 35, - adSchemaMeasures = 36, - adSchemaProperties = 37, - adSchemaMembers = 38, - adSchemaTrustees = 39 -}; - -enum FieldStatusEnum -{ - adFieldOK = 0, - adFieldCantConvertValue = 2, - adFieldIsNull = 3, - adFieldTruncated = 4, - adFieldSignMismatch = 5, - adFieldDataOverflow = 6, - adFieldCantCreate = 7, - adFieldUnavailable = 8, - adFieldPermissionDenied = 9, - adFieldIntegrityViolation = 10, - adFieldSchemaViolation = 11, - adFieldBadStatus = 12, - adFieldDefault = 13, - adFieldIgnore = 15, - adFieldDoesNotExist = 16, - adFieldInvalidURL = 17, - adFieldResourceLocked = 18, - adFieldResourceExists = 19, - adFieldCannotComplete = 20, - adFieldVolumeNotFound = 21, - adFieldOutOfSpace = 22, - adFieldCannotDeleteSource = 23, - adFieldReadOnly = 24, - adFieldResourceOutOfScope = 25, - adFieldAlreadyExists = 26, - adFieldPendingInsert = 65536, - adFieldPendingDelete = 131072, - adFieldPendingChange = 262144, - adFieldPendingUnknown = 524288, - adFieldPendingUnknownDelete = 1048576 -}; - -enum SeekEnum -{ - adSeekFirstEQ = 1, - adSeekLastEQ = 2, - adSeekAfterEQ = 4, - adSeekAfter = 8, - adSeekBeforeEQ = 16, - adSeekBefore = 32 -}; - -enum ADCPROP_UPDATECRITERIA_ENUM -{ - adCriteriaKey = 0, - adCriteriaAllCols = 1, - adCriteriaUpdCols = 2, - adCriteriaTimeStamp = 3 -}; - -enum ADCPROP_ASYNCTHREADPRIORITY_ENUM -{ - adPriorityLowest = 1, - adPriorityBelowNormal = 2, - adPriorityNormal = 3, - adPriorityAboveNormal = 4, - adPriorityHighest = 5 -}; - -enum ADCPROP_AUTORECALC_ENUM -{ - adRecalcUpFront = 0, - adRecalcAlways = 1 -}; - -enum ADCPROP_UPDATERESYNC_ENUM -{ - adResyncNone = 0, - adResyncAutoIncrement = 1, - adResyncConflicts = 2, - adResyncUpdates = 4, - adResyncInserts = 8, - adResyncAll = 15 -}; - -enum MoveRecordOptionsEnum -{ - adMoveUnspecified = -1, - adMoveOverWrite = 1, - adMoveDontUpdateLinks = 2, - adMoveAllowEmulation = 4 -}; - -enum CopyRecordOptionsEnum -{ - adCopyUnspecified = -1, - adCopyOverWrite = 1, - adCopyAllowEmulation = 4, - adCopyNonRecursive = 2 -}; - -enum StreamTypeEnum -{ - adTypeBinary = 1, - adTypeText = 2 -}; - -enum LineSeparatorEnum -{ - adLF = 10, - adCR = 13, - adCRLF = -1 -}; - -enum StreamOpenOptionsEnum -{ - adOpenStreamUnspecified = -1, - adOpenStreamAsync = 1, - adOpenStreamFromRecord = 4 -}; - -enum StreamWriteEnum -{ - adWriteChar = 0, - adWriteLine = 1, - stWriteChar = 0, - stWriteLine = 1 -}; - -enum SaveOptionsEnum -{ - adSaveCreateNotExist = 1, - adSaveCreateOverWrite = 2 -}; - -enum FieldEnum -{ - adDefaultStream = -1, - adRecordURL = -2 -}; - -enum StreamReadEnum -{ - adReadAll = -1, - adReadLine = -2 -}; - -enum RecordTypeEnum -{ - adSimpleRecord = 0, - adCollectionRecord = 1, - adStructDoc = 2 -}; - -struct __declspec(uuid("00000512-0000-0010-8000-00aa006d2ea4")) -_Collection : IDispatch -{ - // - // Property data - // - - __declspec(property(get=GetCount)) - long Count; - - // - // Wrapper methods for error-handling - // - - long GetCount ( ); - IUnknownPtr _NewEnum ( ); - HRESULT Refresh ( ); - - // - // Raw methods provided by interface - // - - virtual HRESULT __stdcall get_Count ( - long * c ) = 0; - virtual HRESULT __stdcall raw__NewEnum ( - IUnknown * * ppvObject ) = 0; - virtual HRESULT __stdcall raw_Refresh ( ) = 0; -}; - -struct __declspec(uuid("00000513-0000-0010-8000-00aa006d2ea4")) -_DynaCollection : _Collection -{ - // - // Wrapper methods for error-handling - // - - HRESULT Append ( - IDispatch * Object ); - HRESULT Delete ( - const _variant_t & Index ); - - // - // Raw methods provided by interface - // - - virtual HRESULT __stdcall raw_Append ( - IDispatch * Object ) = 0; - virtual HRESULT __stdcall raw_Delete ( - VARIANT Index ) = 0; -}; - -struct __declspec(uuid("00000534-0000-0010-8000-00aa006d2ea4")) -_ADO : IDispatch -{ - // - // Property data - // - - __declspec(property(get=GetProperties)) - PropertiesPtr Properties; - - // - // Wrapper methods for error-handling - // - - PropertiesPtr GetProperties ( ); - - // - // Raw methods provided by interface - // - - virtual HRESULT __stdcall get_Properties ( - struct Properties * * ppvObject ) = 0; -}; - -struct __declspec(uuid("00000504-0000-0010-8000-00aa006d2ea4")) -Properties : _Collection -{ - // - // Property data - // - - __declspec(property(get=GetItem)) - PropertyPtr Item[]; - - // - // Wrapper methods for error-handling - // - - PropertyPtr GetItem ( - const _variant_t & Index ); - - // - // Raw methods provided by interface - // - - virtual HRESULT __stdcall get_Item ( - VARIANT Index, - struct Property * * ppvObject ) = 0; -}; - -struct __declspec(uuid("00000503-0000-0010-8000-00aa006d2ea4")) -Property : IDispatch -{ - // - // Property data - // - - __declspec(property(get=GetValue,put=PutValue)) - _variant_t Value; - __declspec(property(get=GetName)) - _bstr_t Name; - __declspec(property(get=GetType)) - enum DataTypeEnum Type; - __declspec(property(get=GetAttributes,put=PutAttributes)) - long Attributes; - - // - // Wrapper methods for error-handling - // - - _variant_t GetValue ( ); - void PutValue ( - const _variant_t & pval ); - _bstr_t GetName ( ); - enum DataTypeEnum GetType ( ); - long GetAttributes ( ); - void PutAttributes ( - long plAttributes ); - - // - // Raw methods provided by interface - // - - virtual HRESULT __stdcall get_Value ( - VARIANT * pval ) = 0; - virtual HRESULT __stdcall put_Value ( - VARIANT pval ) = 0; - virtual HRESULT __stdcall get_Name ( - BSTR * pbstr ) = 0; - virtual HRESULT __stdcall get_Type ( - enum DataTypeEnum * ptype ) = 0; - virtual HRESULT __stdcall get_Attributes ( - long * plAttributes ) = 0; - virtual HRESULT __stdcall put_Attributes ( - long plAttributes ) = 0; -}; - -struct __declspec(uuid("00000500-0000-0010-8000-00aa006d2ea4")) -Error : IDispatch -{ - // - // Property data - // - - __declspec(property(get=GetDescription)) - _bstr_t Description; - __declspec(property(get=GetNumber)) - long Number; - __declspec(property(get=GetSource)) - _bstr_t Source; - __declspec(property(get=GetHelpFile)) - _bstr_t HelpFile; - __declspec(property(get=GetHelpContext)) - long HelpContext; - __declspec(property(get=GetSQLState)) - _bstr_t SQLState; - __declspec(property(get=GetNativeError)) - long NativeError; - - // - // Wrapper methods for error-handling - // - - long GetNumber ( ); - _bstr_t GetSource ( ); - _bstr_t GetDescription ( ); - _bstr_t GetHelpFile ( ); - long GetHelpContext ( ); - _bstr_t GetSQLState ( ); - long GetNativeError ( ); - - // - // Raw methods provided by interface - // - - virtual HRESULT __stdcall get_Number ( - long * pl ) = 0; - virtual HRESULT __stdcall get_Source ( - BSTR * pbstr ) = 0; - virtual HRESULT __stdcall get_Description ( - BSTR * pbstr ) = 0; - virtual HRESULT __stdcall get_HelpFile ( - BSTR * pbstr ) = 0; - virtual HRESULT __stdcall get_HelpContext ( - long * pl ) = 0; - virtual HRESULT __stdcall get_SQLState ( - BSTR * pbstr ) = 0; - virtual HRESULT __stdcall get_NativeError ( - long * pl ) = 0; -}; - -struct __declspec(uuid("00000501-0000-0010-8000-00aa006d2ea4")) -Errors : _Collection -{ - // - // Property data - // - - __declspec(property(get=GetItem)) - ErrorPtr Item[]; - - // - // Wrapper methods for error-handling - // - - ErrorPtr GetItem ( - const _variant_t & Index ); - HRESULT Clear ( ); - - // - // Raw methods provided by interface - // - - virtual HRESULT __stdcall get_Item ( - VARIANT Index, - struct Error * * ppvObject ) = 0; - virtual HRESULT __stdcall raw_Clear ( ) = 0; -}; - -struct __declspec(uuid("00000508-0000-0010-8000-00aa006d2ea4")) -Command15 : _ADO -{ - // - // Property data - // - - __declspec(property(get=GetParameters)) - ParametersPtr Parameters; - __declspec(property(get=GetActiveConnection,put=PutRefActiveConnection)) - _ConnectionPtr ActiveConnection; - __declspec(property(get=GetCommandText,put=PutCommandText)) - _bstr_t CommandText; - __declspec(property(get=GetCommandTimeout,put=PutCommandTimeout)) - long CommandTimeout; - __declspec(property(get=GetPrepared,put=PutPrepared)) - VARIANT_BOOL Prepared; - __declspec(property(get=GetCommandType,put=PutCommandType)) - enum CommandTypeEnum CommandType; - __declspec(property(get=GetName,put=PutName)) - _bstr_t Name; - - // - // Wrapper methods for error-handling - // - - _ConnectionPtr GetActiveConnection ( ); - void PutRefActiveConnection ( - struct _Connection * ppvObject ); - void PutActiveConnection ( - const _variant_t & ppvObject ); - _bstr_t GetCommandText ( ); - void PutCommandText ( - _bstr_t pbstr ); - long GetCommandTimeout ( ); - void PutCommandTimeout ( - long pl ); - VARIANT_BOOL GetPrepared ( ); - void PutPrepared ( - VARIANT_BOOL pfPrepared ); - _RecordsetPtr Execute ( - VARIANT * RecordsAffected, - VARIANT * Parameters, - long Options ); - _ParameterPtr CreateParameter ( - _bstr_t Name, - enum DataTypeEnum Type, - enum ParameterDirectionEnum Direction, - long Size, - const _variant_t & Value = vtMissing ); - ParametersPtr GetParameters ( ); - void PutCommandType ( - enum CommandTypeEnum plCmdType ); - enum CommandTypeEnum GetCommandType ( ); - _bstr_t GetName ( ); - void PutName ( - _bstr_t pbstrName ); - - // - // Raw methods provided by interface - // - - virtual HRESULT __stdcall get_ActiveConnection ( - struct _Connection * * ppvObject ) = 0; - virtual HRESULT __stdcall putref_ActiveConnection ( - struct _Connection * ppvObject ) = 0; - virtual HRESULT __stdcall put_ActiveConnection ( - VARIANT ppvObject ) = 0; - virtual HRESULT __stdcall get_CommandText ( - BSTR * pbstr ) = 0; - virtual HRESULT __stdcall put_CommandText ( - BSTR pbstr ) = 0; - virtual HRESULT __stdcall get_CommandTimeout ( - long * pl ) = 0; - virtual HRESULT __stdcall put_CommandTimeout ( - long pl ) = 0; - virtual HRESULT __stdcall get_Prepared ( - VARIANT_BOOL * pfPrepared ) = 0; - virtual HRESULT __stdcall put_Prepared ( - VARIANT_BOOL pfPrepared ) = 0; - virtual HRESULT __stdcall raw_Execute ( - VARIANT * RecordsAffected, - VARIANT * Parameters, - long Options, - struct _Recordset * * ppiRs ) = 0; - virtual HRESULT __stdcall raw_CreateParameter ( - BSTR Name, - enum DataTypeEnum Type, - enum ParameterDirectionEnum Direction, - long Size, - VARIANT Value, - struct _Parameter * * ppiprm ) = 0; - virtual HRESULT __stdcall get_Parameters ( - struct Parameters * * ppvObject ) = 0; - virtual HRESULT __stdcall put_CommandType ( - enum CommandTypeEnum plCmdType ) = 0; - virtual HRESULT __stdcall get_CommandType ( - enum CommandTypeEnum * plCmdType ) = 0; - virtual HRESULT __stdcall get_Name ( - BSTR * pbstrName ) = 0; - virtual HRESULT __stdcall put_Name ( - BSTR pbstrName ) = 0; -}; - -struct __declspec(uuid("00000515-0000-0010-8000-00aa006d2ea4")) -Connection15 : _ADO -{ - // - // Property data - // - - __declspec(property(get=GetConnectionString,put=PutConnectionString)) - _bstr_t ConnectionString; - __declspec(property(get=GetCommandTimeout,put=PutCommandTimeout)) - long CommandTimeout; - __declspec(property(get=GetConnectionTimeout,put=PutConnectionTimeout)) - long ConnectionTimeout; - __declspec(property(get=GetVersion)) - _bstr_t Version; - __declspec(property(get=GetErrors)) - ErrorsPtr Errors; - __declspec(property(get=GetDefaultDatabase,put=PutDefaultDatabase)) - _bstr_t DefaultDatabase; - __declspec(property(get=GetIsolationLevel,put=PutIsolationLevel)) - enum IsolationLevelEnum IsolationLevel; - __declspec(property(get=GetAttributes,put=PutAttributes)) - long Attributes; - __declspec(property(get=GetCursorLocation,put=PutCursorLocation)) - enum CursorLocationEnum CursorLocation; - __declspec(property(get=GetMode,put=PutMode)) - enum ConnectModeEnum Mode; - __declspec(property(get=GetProvider,put=PutProvider)) - _bstr_t Provider; - __declspec(property(get=GetState)) - long State; - - // - // Wrapper methods for error-handling - // - - _bstr_t GetConnectionString ( ); - void PutConnectionString ( - _bstr_t pbstr ); - long GetCommandTimeout ( ); - void PutCommandTimeout ( - long plTimeout ); - long GetConnectionTimeout ( ); - void PutConnectionTimeout ( - long plTimeout ); - _bstr_t GetVersion ( ); - HRESULT Close ( ); - _RecordsetPtr Execute ( - _bstr_t CommandText, - VARIANT * RecordsAffected, - long Options ); - long BeginTrans ( ); - HRESULT CommitTrans ( ); - HRESULT RollbackTrans ( ); - HRESULT Open ( - _bstr_t ConnectionString, - _bstr_t UserID, - _bstr_t Password, - long Options ); - ErrorsPtr GetErrors ( ); - _bstr_t GetDefaultDatabase ( ); - void PutDefaultDatabase ( - _bstr_t pbstr ); - enum IsolationLevelEnum GetIsolationLevel ( ); - void PutIsolationLevel ( - enum IsolationLevelEnum Level ); - long GetAttributes ( ); - void PutAttributes ( - long plAttr ); - enum CursorLocationEnum GetCursorLocation ( ); - void PutCursorLocation ( - enum CursorLocationEnum plCursorLoc ); - enum ConnectModeEnum GetMode ( ); - void PutMode ( - enum ConnectModeEnum plMode ); - _bstr_t GetProvider ( ); - void PutProvider ( - _bstr_t pbstr ); - long GetState ( ); - _RecordsetPtr OpenSchema ( - enum SchemaEnum Schema, - const _variant_t & Restrictions = vtMissing, - const _variant_t & SchemaID = vtMissing ); - - // - // Raw methods provided by interface - // - - virtual HRESULT __stdcall get_ConnectionString ( - BSTR * pbstr ) = 0; - virtual HRESULT __stdcall put_ConnectionString ( - BSTR pbstr ) = 0; - virtual HRESULT __stdcall get_CommandTimeout ( - long * plTimeout ) = 0; - virtual HRESULT __stdcall put_CommandTimeout ( - long plTimeout ) = 0; - virtual HRESULT __stdcall get_ConnectionTimeout ( - long * plTimeout ) = 0; - virtual HRESULT __stdcall put_ConnectionTimeout ( - long plTimeout ) = 0; - virtual HRESULT __stdcall get_Version ( - BSTR * pbstr ) = 0; - virtual HRESULT __stdcall raw_Close ( ) = 0; - virtual HRESULT __stdcall raw_Execute ( - BSTR CommandText, - VARIANT * RecordsAffected, - long Options, - struct _Recordset * * ppiRset ) = 0; - virtual HRESULT __stdcall raw_BeginTrans ( - long * TransactionLevel ) = 0; - virtual HRESULT __stdcall raw_CommitTrans ( ) = 0; - virtual HRESULT __stdcall raw_RollbackTrans ( ) = 0; - virtual HRESULT __stdcall raw_Open ( - BSTR ConnectionString, - BSTR UserID, - BSTR Password, - long Options ) = 0; - virtual HRESULT __stdcall get_Errors ( - struct Errors * * ppvObject ) = 0; - virtual HRESULT __stdcall get_DefaultDatabase ( - BSTR * pbstr ) = 0; - virtual HRESULT __stdcall put_DefaultDatabase ( - BSTR pbstr ) = 0; - virtual HRESULT __stdcall get_IsolationLevel ( - enum IsolationLevelEnum * Level ) = 0; - virtual HRESULT __stdcall put_IsolationLevel ( - enum IsolationLevelEnum Level ) = 0; - virtual HRESULT __stdcall get_Attributes ( - long * plAttr ) = 0; - virtual HRESULT __stdcall put_Attributes ( - long plAttr ) = 0; - virtual HRESULT __stdcall get_CursorLocation ( - enum CursorLocationEnum * plCursorLoc ) = 0; - virtual HRESULT __stdcall put_CursorLocation ( - enum CursorLocationEnum plCursorLoc ) = 0; - virtual HRESULT __stdcall get_Mode ( - enum ConnectModeEnum * plMode ) = 0; - virtual HRESULT __stdcall put_Mode ( - enum ConnectModeEnum plMode ) = 0; - virtual HRESULT __stdcall get_Provider ( - BSTR * pbstr ) = 0; - virtual HRESULT __stdcall put_Provider ( - BSTR pbstr ) = 0; - virtual HRESULT __stdcall get_State ( - long * plObjState ) = 0; - virtual HRESULT __stdcall raw_OpenSchema ( - enum SchemaEnum Schema, - VARIANT Restrictions, - VARIANT SchemaID, - struct _Recordset * * pprset ) = 0; -}; - -struct __declspec(uuid("00000550-0000-0010-8000-00aa006d2ea4")) -_Connection : Connection15 -{ - // - // Wrapper methods for error-handling - // - - HRESULT Cancel ( ); - - // - // Raw methods provided by interface - // - - virtual HRESULT __stdcall raw_Cancel ( ) = 0; -}; - -struct __declspec(uuid("0000050e-0000-0010-8000-00aa006d2ea4")) -Recordset15 : _ADO -{ - // - // Property data - // - - __declspec(property(get=GetFields)) - FieldsPtr Fields; - __declspec(property(get=GetPageSize,put=PutPageSize)) - long PageSize; - __declspec(property(get=GetPageCount)) - long PageCount; - __declspec(property(get=GetCursorLocation,put=PutCursorLocation)) - enum CursorLocationEnum CursorLocation; - __declspec(property(get=GetState)) - long State; - __declspec(property(get=GetMarshalOptions,put=PutMarshalOptions)) - enum MarshalOptionsEnum MarshalOptions; - __declspec(property(get=GetCollect,put=PutCollect)) - _variant_t Collect[]; - __declspec(property(get=GetEditMode)) - enum EditModeEnum EditMode; - __declspec(property(get=GetStatus)) - long Status; - __declspec(property(get=GetFilter,put=PutFilter)) - _variant_t Filter; - __declspec(property(get=GetSort,put=PutSort)) - _bstr_t Sort; - __declspec(property(get=GetAbsolutePosition,put=PutAbsolutePosition)) - enum PositionEnum AbsolutePosition; - __declspec(property(get=GetBOF)) - VARIANT_BOOL BOF; - __declspec(property(get=GetBookmark,put=PutBookmark)) - _variant_t Bookmark; - __declspec(property(get=GetCacheSize,put=PutCacheSize)) - long CacheSize; - __declspec(property(get=GetCursorType,put=PutCursorType)) - enum CursorTypeEnum CursorType; - __declspec(property(get=GetadoEOF)) - VARIANT_BOOL adoEOF; - __declspec(property(get=GetAbsolutePage,put=PutAbsolutePage)) - enum PositionEnum AbsolutePage; - __declspec(property(get=GetLockType,put=PutLockType)) - enum LockTypeEnum LockType; - __declspec(property(get=GetMaxRecords,put=PutMaxRecords)) - long MaxRecords; - __declspec(property(get=GetRecordCount)) - long RecordCount; - - // - // Wrapper methods for error-handling - // - - enum PositionEnum GetAbsolutePosition ( ); - void PutAbsolutePosition ( - enum PositionEnum pl ); - void PutRefActiveConnection ( - IDispatch * pvar ); - void PutActiveConnection ( - const _variant_t & pvar ); - _variant_t GetActiveConnection ( ); - VARIANT_BOOL GetBOF ( ); - _variant_t GetBookmark ( ); - void PutBookmark ( - const _variant_t & pvBookmark ); - long GetCacheSize ( ); - void PutCacheSize ( - long pl ); - enum CursorTypeEnum GetCursorType ( ); - void PutCursorType ( - enum CursorTypeEnum plCursorType ); - VARIANT_BOOL GetadoEOF ( ); - FieldsPtr GetFields ( ); - enum LockTypeEnum GetLockType ( ); - void PutLockType ( - enum LockTypeEnum plLockType ); - long GetMaxRecords ( ); - void PutMaxRecords ( - long plMaxRecords ); - long GetRecordCount ( ); - void PutRefSource ( - IDispatch * pvSource ); - void PutSource ( - _bstr_t pvSource ); - _variant_t GetSource ( ); - HRESULT AddNew ( - const _variant_t & FieldList = vtMissing, - const _variant_t & Values = vtMissing ); - HRESULT CancelUpdate ( ); - HRESULT Close ( ); - HRESULT Delete ( - enum AffectEnum AffectRecords ); - _variant_t GetRows ( - long Rows, - const _variant_t & Start = vtMissing, - const _variant_t & Fields = vtMissing ); - HRESULT Move ( - long NumRecords, - const _variant_t & Start = vtMissing ); - HRESULT MoveNext ( ); - HRESULT MovePrevious ( ); - HRESULT MoveFirst ( ); - HRESULT MoveLast ( ); - HRESULT Open ( - const _variant_t & Source, - const _variant_t & ActiveConnection, - enum CursorTypeEnum CursorType, - enum LockTypeEnum LockType, - long Options ); - HRESULT Requery ( - long Options ); - HRESULT _xResync ( - enum AffectEnum AffectRecords ); - HRESULT Update ( - const _variant_t & Fields = vtMissing, - const _variant_t & Values = vtMissing ); - enum PositionEnum GetAbsolutePage ( ); - void PutAbsolutePage ( - enum PositionEnum pl ); - enum EditModeEnum GetEditMode ( ); - _variant_t GetFilter ( ); - void PutFilter ( - const _variant_t & Criteria ); - long GetPageCount ( ); - long GetPageSize ( ); - void PutPageSize ( - long pl ); - _bstr_t GetSort ( ); - void PutSort ( - _bstr_t Criteria ); - long GetStatus ( ); - long GetState ( ); - _RecordsetPtr _xClone ( ); - HRESULT UpdateBatch ( - enum AffectEnum AffectRecords ); - HRESULT CancelBatch ( - enum AffectEnum AffectRecords ); - enum CursorLocationEnum GetCursorLocation ( ); - void PutCursorLocation ( - enum CursorLocationEnum plCursorLoc ); - _RecordsetPtr NextRecordset ( - VARIANT * RecordsAffected ); - VARIANT_BOOL Supports ( - enum CursorOptionEnum CursorOptions ); - _variant_t GetCollect ( - const _variant_t & Index ); - void PutCollect ( - const _variant_t & Index, - const _variant_t & pvar ); - enum MarshalOptionsEnum GetMarshalOptions ( ); - void PutMarshalOptions ( - enum MarshalOptionsEnum peMarshal ); - HRESULT Find ( - _bstr_t Criteria, - long SkipRecords, - enum SearchDirectionEnum SearchDirection, - const _variant_t & Start = vtMissing ); - - // - // Raw methods provided by interface - // - - virtual HRESULT __stdcall get_AbsolutePosition ( - enum PositionEnum * pl ) = 0; - virtual HRESULT __stdcall put_AbsolutePosition ( - enum PositionEnum pl ) = 0; - virtual HRESULT __stdcall putref_ActiveConnection ( - IDispatch * pvar ) = 0; - virtual HRESULT __stdcall put_ActiveConnection ( - VARIANT pvar ) = 0; - virtual HRESULT __stdcall get_ActiveConnection ( - VARIANT * pvar ) = 0; - virtual HRESULT __stdcall get_BOF ( - VARIANT_BOOL * pb ) = 0; - virtual HRESULT __stdcall get_Bookmark ( - VARIANT * pvBookmark ) = 0; - virtual HRESULT __stdcall put_Bookmark ( - VARIANT pvBookmark ) = 0; - virtual HRESULT __stdcall get_CacheSize ( - long * pl ) = 0; - virtual HRESULT __stdcall put_CacheSize ( - long pl ) = 0; - virtual HRESULT __stdcall get_CursorType ( - enum CursorTypeEnum * plCursorType ) = 0; - virtual HRESULT __stdcall put_CursorType ( - enum CursorTypeEnum plCursorType ) = 0; - virtual HRESULT __stdcall get_adoEOF ( - VARIANT_BOOL * pb ) = 0; - virtual HRESULT __stdcall get_Fields ( - struct Fields * * ppvObject ) = 0; - virtual HRESULT __stdcall get_LockType ( - enum LockTypeEnum * plLockType ) = 0; - virtual HRESULT __stdcall put_LockType ( - enum LockTypeEnum plLockType ) = 0; - virtual HRESULT __stdcall get_MaxRecords ( - long * plMaxRecords ) = 0; - virtual HRESULT __stdcall put_MaxRecords ( - long plMaxRecords ) = 0; - virtual HRESULT __stdcall get_RecordCount ( - long * pl ) = 0; - virtual HRESULT __stdcall putref_Source ( - IDispatch * pvSource ) = 0; - virtual HRESULT __stdcall put_Source ( - BSTR pvSource ) = 0; - virtual HRESULT __stdcall get_Source ( - VARIANT * pvSource ) = 0; - virtual HRESULT __stdcall raw_AddNew ( - VARIANT FieldList = vtMissing, - VARIANT Values = vtMissing ) = 0; - virtual HRESULT __stdcall raw_CancelUpdate ( ) = 0; - virtual HRESULT __stdcall raw_Close ( ) = 0; - virtual HRESULT __stdcall raw_Delete ( - enum AffectEnum AffectRecords ) = 0; - virtual HRESULT __stdcall raw_GetRows ( - long Rows, - VARIANT Start, - VARIANT Fields, - VARIANT * pvar ) = 0; - virtual HRESULT __stdcall raw_Move ( - long NumRecords, - VARIANT Start = vtMissing ) = 0; - virtual HRESULT __stdcall raw_MoveNext ( ) = 0; - virtual HRESULT __stdcall raw_MovePrevious ( ) = 0; - virtual HRESULT __stdcall raw_MoveFirst ( ) = 0; - virtual HRESULT __stdcall raw_MoveLast ( ) = 0; - virtual HRESULT __stdcall raw_Open ( - VARIANT Source, - VARIANT ActiveConnection, - enum CursorTypeEnum CursorType, - enum LockTypeEnum LockType, - long Options ) = 0; - virtual HRESULT __stdcall raw_Requery ( - long Options ) = 0; - virtual HRESULT __stdcall raw__xResync ( - enum AffectEnum AffectRecords ) = 0; - virtual HRESULT __stdcall raw_Update ( - VARIANT Fields = vtMissing, - VARIANT Values = vtMissing ) = 0; - virtual HRESULT __stdcall get_AbsolutePage ( - enum PositionEnum * pl ) = 0; - virtual HRESULT __stdcall put_AbsolutePage ( - enum PositionEnum pl ) = 0; - virtual HRESULT __stdcall get_EditMode ( - enum EditModeEnum * pl ) = 0; - virtual HRESULT __stdcall get_Filter ( - VARIANT * Criteria ) = 0; - virtual HRESULT __stdcall put_Filter ( - VARIANT Criteria ) = 0; - virtual HRESULT __stdcall get_PageCount ( - long * pl ) = 0; - virtual HRESULT __stdcall get_PageSize ( - long * pl ) = 0; - virtual HRESULT __stdcall put_PageSize ( - long pl ) = 0; - virtual HRESULT __stdcall get_Sort ( - BSTR * Criteria ) = 0; - virtual HRESULT __stdcall put_Sort ( - BSTR Criteria ) = 0; - virtual HRESULT __stdcall get_Status ( - long * pl ) = 0; - virtual HRESULT __stdcall get_State ( - long * plObjState ) = 0; - virtual HRESULT __stdcall raw__xClone ( - struct _Recordset * * ppvObject ) = 0; - virtual HRESULT __stdcall raw_UpdateBatch ( - enum AffectEnum AffectRecords ) = 0; - virtual HRESULT __stdcall raw_CancelBatch ( - enum AffectEnum AffectRecords ) = 0; - virtual HRESULT __stdcall get_CursorLocation ( - enum CursorLocationEnum * plCursorLoc ) = 0; - virtual HRESULT __stdcall put_CursorLocation ( - enum CursorLocationEnum plCursorLoc ) = 0; - virtual HRESULT __stdcall raw_NextRecordset ( - VARIANT * RecordsAffected, - struct _Recordset * * ppiRs ) = 0; - virtual HRESULT __stdcall raw_Supports ( - enum CursorOptionEnum CursorOptions, - VARIANT_BOOL * pb ) = 0; - virtual HRESULT __stdcall get_Collect ( - VARIANT Index, - VARIANT * pvar ) = 0; - virtual HRESULT __stdcall put_Collect ( - VARIANT Index, - VARIANT pvar ) = 0; - virtual HRESULT __stdcall get_MarshalOptions ( - enum MarshalOptionsEnum * peMarshal ) = 0; - virtual HRESULT __stdcall put_MarshalOptions ( - enum MarshalOptionsEnum peMarshal ) = 0; - virtual HRESULT __stdcall raw_Find ( - BSTR Criteria, - long SkipRecords, - enum SearchDirectionEnum SearchDirection, - VARIANT Start = vtMissing ) = 0; -}; - -struct __declspec(uuid("0000054f-0000-0010-8000-00aa006d2ea4")) -Recordset20 : Recordset15 -{ - // - // Property data - // - - __declspec(property(get=GetDataSource,put=PutRefDataSource)) - IUnknownPtr DataSource; - __declspec(property(get=GetActiveCommand)) - IDispatchPtr ActiveCommand; - __declspec(property(get=GetStayInSync,put=PutStayInSync)) - VARIANT_BOOL StayInSync; - __declspec(property(get=GetDataMember,put=PutDataMember)) - _bstr_t DataMember; - - // - // Wrapper methods for error-handling - // - - HRESULT Cancel ( ); - IUnknownPtr GetDataSource ( ); - void PutRefDataSource ( - IUnknown * ppunkDataSource ); - HRESULT _xSave ( - _bstr_t FileName, - enum PersistFormatEnum PersistFormat ); - IDispatchPtr GetActiveCommand ( ); - void PutStayInSync ( - VARIANT_BOOL pbStayInSync ); - VARIANT_BOOL GetStayInSync ( ); - _bstr_t GetString ( - enum StringFormatEnum StringFormat, - long NumRows, - _bstr_t ColumnDelimeter, - _bstr_t RowDelimeter, - _bstr_t NullExpr ); - _bstr_t GetDataMember ( ); - void PutDataMember ( - _bstr_t pbstrDataMember ); - enum CompareEnum CompareBookmarks ( - const _variant_t & Bookmark1, - const _variant_t & Bookmark2 ); - _RecordsetPtr Clone ( - enum LockTypeEnum LockType ); - HRESULT Resync ( - enum AffectEnum AffectRecords, - enum ResyncEnum ResyncValues ); - - // - // Raw methods provided by interface - // - - virtual HRESULT __stdcall raw_Cancel ( ) = 0; - virtual HRESULT __stdcall get_DataSource ( - IUnknown * * ppunkDataSource ) = 0; - virtual HRESULT __stdcall putref_DataSource ( - IUnknown * ppunkDataSource ) = 0; - virtual HRESULT __stdcall raw__xSave ( - BSTR FileName, - enum PersistFormatEnum PersistFormat ) = 0; - virtual HRESULT __stdcall get_ActiveCommand ( - IDispatch * * ppCmd ) = 0; - virtual HRESULT __stdcall put_StayInSync ( - VARIANT_BOOL pbStayInSync ) = 0; - virtual HRESULT __stdcall get_StayInSync ( - VARIANT_BOOL * pbStayInSync ) = 0; - virtual HRESULT __stdcall raw_GetString ( - enum StringFormatEnum StringFormat, - long NumRows, - BSTR ColumnDelimeter, - BSTR RowDelimeter, - BSTR NullExpr, - BSTR * pRetString ) = 0; - virtual HRESULT __stdcall get_DataMember ( - BSTR * pbstrDataMember ) = 0; - virtual HRESULT __stdcall put_DataMember ( - BSTR pbstrDataMember ) = 0; - virtual HRESULT __stdcall raw_CompareBookmarks ( - VARIANT Bookmark1, - VARIANT Bookmark2, - enum CompareEnum * pCompare ) = 0; - virtual HRESULT __stdcall raw_Clone ( - enum LockTypeEnum LockType, - struct _Recordset * * ppvObject ) = 0; - virtual HRESULT __stdcall raw_Resync ( - enum AffectEnum AffectRecords, - enum ResyncEnum ResyncValues ) = 0; -}; - -struct __declspec(uuid("00000555-0000-0010-8000-00aa006d2ea4")) -Recordset21 : Recordset20 -{ - // - // Property data - // - - __declspec(property(get=GetIndex,put=PutIndex)) - _bstr_t Index; - - // - // Wrapper methods for error-handling - // - - HRESULT Seek ( - const _variant_t & KeyValues, - enum SeekEnum SeekOption ); - void PutIndex ( - _bstr_t pbstrIndex ); - _bstr_t GetIndex ( ); - - // - // Raw methods provided by interface - // - - virtual HRESULT __stdcall raw_Seek ( - VARIANT KeyValues, - enum SeekEnum SeekOption ) = 0; - virtual HRESULT __stdcall put_Index ( - BSTR pbstrIndex ) = 0; - virtual HRESULT __stdcall get_Index ( - BSTR * pbstrIndex ) = 0; -}; - -struct __declspec(uuid("00000556-0000-0010-8000-00aa006d2ea4")) -_Recordset : Recordset21 -{ - // - // Wrapper methods for error-handling - // - - HRESULT Save ( - const _variant_t & Destination, - enum PersistFormatEnum PersistFormat ); - - // - // Raw methods provided by interface - // - - virtual HRESULT __stdcall raw_Save ( - VARIANT Destination, - enum PersistFormatEnum PersistFormat ) = 0; -}; - -struct __declspec(uuid("00000506-0000-0010-8000-00aa006d2ea4")) -Fields15 : _Collection -{ - // - // Property data - // - - __declspec(property(get=GetItem)) - FieldPtr Item[]; - - // - // Wrapper methods for error-handling - // - - FieldPtr GetItem ( - const _variant_t & Index ); - - // - // Raw methods provided by interface - // - - virtual HRESULT __stdcall get_Item ( - VARIANT Index, - struct Field * * ppvObject ) = 0; -}; - -struct __declspec(uuid("0000054d-0000-0010-8000-00aa006d2ea4")) -Fields20 : Fields15 -{ - // - // Wrapper methods for error-handling - // - - HRESULT _Append ( - _bstr_t Name, - enum DataTypeEnum Type, - long DefinedSize, - enum FieldAttributeEnum Attrib ); - HRESULT Delete ( - const _variant_t & Index ); - - // - // Raw methods provided by interface - // - - virtual HRESULT __stdcall raw__Append ( - BSTR Name, - enum DataTypeEnum Type, - long DefinedSize, - enum FieldAttributeEnum Attrib ) = 0; - virtual HRESULT __stdcall raw_Delete ( - VARIANT Index ) = 0; -}; - -struct __declspec(uuid("00000564-0000-0010-8000-00aa006d2ea4")) -Fields : Fields20 -{ - // - // Wrapper methods for error-handling - // - - HRESULT Append ( - _bstr_t Name, - enum DataTypeEnum Type, - long DefinedSize, - enum FieldAttributeEnum Attrib, - const _variant_t & FieldValue = vtMissing ); - HRESULT Update ( ); - HRESULT Resync ( - enum ResyncEnum ResyncValues ); - HRESULT CancelUpdate ( ); - - // - // Raw methods provided by interface - // - - virtual HRESULT __stdcall raw_Append ( - BSTR Name, - enum DataTypeEnum Type, - long DefinedSize, - enum FieldAttributeEnum Attrib, - VARIANT FieldValue = vtMissing ) = 0; - virtual HRESULT __stdcall raw_Update ( ) = 0; - virtual HRESULT __stdcall raw_Resync ( - enum ResyncEnum ResyncValues ) = 0; - virtual HRESULT __stdcall raw_CancelUpdate ( ) = 0; -}; - -struct __declspec(uuid("0000054c-0000-0010-8000-00aa006d2ea4")) -Field20 : _ADO -{ - // - // Property data - // - - __declspec(property(get=GetValue,put=PutValue)) - _variant_t Value; - __declspec(property(get=GetName)) - _bstr_t Name; - __declspec(property(get=GetType,put=PutType)) - enum DataTypeEnum Type; - __declspec(property(get=GetDefinedSize,put=PutDefinedSize)) - long DefinedSize; - __declspec(property(get=GetOriginalValue)) - _variant_t OriginalValue; - __declspec(property(get=GetUnderlyingValue)) - _variant_t UnderlyingValue; - __declspec(property(get=GetActualSize)) - long ActualSize; - __declspec(property(get=GetPrecision,put=PutPrecision)) - unsigned char Precision; - __declspec(property(get=GetNumericScale,put=PutNumericScale)) - unsigned char NumericScale; - __declspec(property(get=GetAttributes,put=PutAttributes)) - long Attributes; - __declspec(property(get=GetDataFormat,put=PutRefDataFormat)) - IUnknownPtr DataFormat; - - // - // Wrapper methods for error-handling - // - - long GetActualSize ( ); - long GetAttributes ( ); - long GetDefinedSize ( ); - _bstr_t GetName ( ); - enum DataTypeEnum GetType ( ); - _variant_t GetValue ( ); - void PutValue ( - const _variant_t & pvar ); - unsigned char GetPrecision ( ); - unsigned char GetNumericScale ( ); - HRESULT AppendChunk ( - const _variant_t & Data ); - _variant_t GetChunk ( - long Length ); - _variant_t GetOriginalValue ( ); - _variant_t GetUnderlyingValue ( ); - IUnknownPtr GetDataFormat ( ); - void PutRefDataFormat ( - IUnknown * ppiDF ); - void PutPrecision ( - unsigned char pbPrecision ); - void PutNumericScale ( - unsigned char pbNumericScale ); - void PutType ( - enum DataTypeEnum pDataType ); - void PutDefinedSize ( - long pl ); - void PutAttributes ( - long pl ); - - // - // Raw methods provided by interface - // - - virtual HRESULT __stdcall get_ActualSize ( - long * pl ) = 0; - virtual HRESULT __stdcall get_Attributes ( - long * pl ) = 0; - virtual HRESULT __stdcall get_DefinedSize ( - long * pl ) = 0; - virtual HRESULT __stdcall get_Name ( - BSTR * pbstr ) = 0; - virtual HRESULT __stdcall get_Type ( - enum DataTypeEnum * pDataType ) = 0; - virtual HRESULT __stdcall get_Value ( - VARIANT * pvar ) = 0; - virtual HRESULT __stdcall put_Value ( - VARIANT pvar ) = 0; - virtual HRESULT __stdcall get_Precision ( - unsigned char * pbPrecision ) = 0; - virtual HRESULT __stdcall get_NumericScale ( - unsigned char * pbNumericScale ) = 0; - virtual HRESULT __stdcall raw_AppendChunk ( - VARIANT Data ) = 0; - virtual HRESULT __stdcall raw_GetChunk ( - long Length, - VARIANT * pvar ) = 0; - virtual HRESULT __stdcall get_OriginalValue ( - VARIANT * pvar ) = 0; - virtual HRESULT __stdcall get_UnderlyingValue ( - VARIANT * pvar ) = 0; - virtual HRESULT __stdcall get_DataFormat ( - IUnknown * * ppiDF ) = 0; - virtual HRESULT __stdcall putref_DataFormat ( - IUnknown * ppiDF ) = 0; - virtual HRESULT __stdcall put_Precision ( - unsigned char pbPrecision ) = 0; - virtual HRESULT __stdcall put_NumericScale ( - unsigned char pbNumericScale ) = 0; - virtual HRESULT __stdcall put_Type ( - enum DataTypeEnum pDataType ) = 0; - virtual HRESULT __stdcall put_DefinedSize ( - long pl ) = 0; - virtual HRESULT __stdcall put_Attributes ( - long pl ) = 0; -}; - -struct __declspec(uuid("00000569-0000-0010-8000-00aa006d2ea4")) -Field : Field20 -{ - // - // Property data - // - - __declspec(property(get=GetStatus)) - long Status; - - // - // Wrapper methods for error-handling - // - - long GetStatus ( ); - - // - // Raw methods provided by interface - // - - virtual HRESULT __stdcall get_Status ( - long * pFStatus ) = 0; -}; - -struct __declspec(uuid("0000050c-0000-0010-8000-00aa006d2ea4")) -_Parameter : _ADO -{ - // - // Property data - // - - __declspec(property(get=GetValue,put=PutValue)) - _variant_t Value; - __declspec(property(get=GetName,put=PutName)) - _bstr_t Name; - __declspec(property(get=GetType,put=PutType)) - enum DataTypeEnum Type; - __declspec(property(get=GetDirection,put=PutDirection)) - enum ParameterDirectionEnum Direction; - __declspec(property(get=GetPrecision,put=PutPrecision)) - unsigned char Precision; - __declspec(property(get=GetNumericScale,put=PutNumericScale)) - unsigned char NumericScale; - __declspec(property(get=GetSize,put=PutSize)) - long Size; - __declspec(property(get=GetAttributes,put=PutAttributes)) - long Attributes; - - // - // Wrapper methods for error-handling - // - - _bstr_t GetName ( ); - void PutName ( - _bstr_t pbstr ); - _variant_t GetValue ( ); - void PutValue ( - const _variant_t & pvar ); - enum DataTypeEnum GetType ( ); - void PutType ( - enum DataTypeEnum psDataType ); - void PutDirection ( - enum ParameterDirectionEnum plParmDirection ); - enum ParameterDirectionEnum GetDirection ( ); - void PutPrecision ( - unsigned char pbPrecision ); - unsigned char GetPrecision ( ); - void PutNumericScale ( - unsigned char pbScale ); - unsigned char GetNumericScale ( ); - void PutSize ( - long pl ); - long GetSize ( ); - HRESULT AppendChunk ( - const _variant_t & Val ); - long GetAttributes ( ); - void PutAttributes ( - long plParmAttribs ); - - // - // Raw methods provided by interface - // - - virtual HRESULT __stdcall get_Name ( - BSTR * pbstr ) = 0; - virtual HRESULT __stdcall put_Name ( - BSTR pbstr ) = 0; - virtual HRESULT __stdcall get_Value ( - VARIANT * pvar ) = 0; - virtual HRESULT __stdcall put_Value ( - VARIANT pvar ) = 0; - virtual HRESULT __stdcall get_Type ( - enum DataTypeEnum * psDataType ) = 0; - virtual HRESULT __stdcall put_Type ( - enum DataTypeEnum psDataType ) = 0; - virtual HRESULT __stdcall put_Direction ( - enum ParameterDirectionEnum plParmDirection ) = 0; - virtual HRESULT __stdcall get_Direction ( - enum ParameterDirectionEnum * plParmDirection ) = 0; - virtual HRESULT __stdcall put_Precision ( - unsigned char pbPrecision ) = 0; - virtual HRESULT __stdcall get_Precision ( - unsigned char * pbPrecision ) = 0; - virtual HRESULT __stdcall put_NumericScale ( - unsigned char pbScale ) = 0; - virtual HRESULT __stdcall get_NumericScale ( - unsigned char * pbScale ) = 0; - virtual HRESULT __stdcall put_Size ( - long pl ) = 0; - virtual HRESULT __stdcall get_Size ( - long * pl ) = 0; - virtual HRESULT __stdcall raw_AppendChunk ( - VARIANT Val ) = 0; - virtual HRESULT __stdcall get_Attributes ( - long * plParmAttribs ) = 0; - virtual HRESULT __stdcall put_Attributes ( - long plParmAttribs ) = 0; -}; - -struct __declspec(uuid("0000050d-0000-0010-8000-00aa006d2ea4")) -Parameters : _DynaCollection -{ - // - // Property data - // - - __declspec(property(get=GetItem)) - _ParameterPtr Item[]; - - // - // Wrapper methods for error-handling - // - - _ParameterPtr GetItem ( - const _variant_t & Index ); - - // - // Raw methods provided by interface - // - - virtual HRESULT __stdcall get_Item ( - VARIANT Index, - struct _Parameter * * ppvObject ) = 0; -}; - -struct __declspec(uuid("0000054e-0000-0010-8000-00aa006d2ea4")) -_Command : Command15 -{ - // - // Property data - // - - __declspec(property(get=GetState)) - long State; - - // - // Wrapper methods for error-handling - // - - long GetState ( ); - HRESULT Cancel ( ); - - // - // Raw methods provided by interface - // - - virtual HRESULT __stdcall get_State ( - long * plObjState ) = 0; - virtual HRESULT __stdcall raw_Cancel ( ) = 0; -}; - -struct __declspec(uuid("00000402-0000-0010-8000-00aa006d2ea4")) -ConnectionEventsVt : IUnknown -{ - // - // Wrapper methods for error-handling - // - - HRESULT InfoMessage ( - struct Error * pError, - enum EventStatusEnum * adStatus, - struct _Connection * pConnection ); - HRESULT BeginTransComplete ( - long TransactionLevel, - struct Error * pError, - enum EventStatusEnum * adStatus, - struct _Connection * pConnection ); - HRESULT CommitTransComplete ( - struct Error * pError, - enum EventStatusEnum * adStatus, - struct _Connection * pConnection ); - HRESULT RollbackTransComplete ( - struct Error * pError, - enum EventStatusEnum * adStatus, - struct _Connection * pConnection ); - HRESULT WillExecute ( - BSTR * Source, - enum CursorTypeEnum * CursorType, - enum LockTypeEnum * LockType, - long * Options, - enum EventStatusEnum * adStatus, - struct _Command * pCommand, - struct _Recordset * pRecordset, - struct _Connection * pConnection ); - HRESULT ExecuteComplete ( - long RecordsAffected, - struct Error * pError, - enum EventStatusEnum * adStatus, - struct _Command * pCommand, - struct _Recordset * pRecordset, - struct _Connection * pConnection ); - HRESULT WillConnect ( - BSTR * ConnectionString, - BSTR * UserID, - BSTR * Password, - long * Options, - enum EventStatusEnum * adStatus, - struct _Connection * pConnection ); - HRESULT ConnectComplete ( - struct Error * pError, - enum EventStatusEnum * adStatus, - struct _Connection * pConnection ); - HRESULT Disconnect ( - enum EventStatusEnum * adStatus, - struct _Connection * pConnection ); - - // - // Raw methods provided by interface - // - - virtual HRESULT __stdcall raw_InfoMessage ( - struct Error * pError, - enum EventStatusEnum * adStatus, - struct _Connection * pConnection ) = 0; - virtual HRESULT __stdcall raw_BeginTransComplete ( - long TransactionLevel, - struct Error * pError, - enum EventStatusEnum * adStatus, - struct _Connection * pConnection ) = 0; - virtual HRESULT __stdcall raw_CommitTransComplete ( - struct Error * pError, - enum EventStatusEnum * adStatus, - struct _Connection * pConnection ) = 0; - virtual HRESULT __stdcall raw_RollbackTransComplete ( - struct Error * pError, - enum EventStatusEnum * adStatus, - struct _Connection * pConnection ) = 0; - virtual HRESULT __stdcall raw_WillExecute ( - BSTR * Source, - enum CursorTypeEnum * CursorType, - enum LockTypeEnum * LockType, - long * Options, - enum EventStatusEnum * adStatus, - struct _Command * pCommand, - struct _Recordset * pRecordset, - struct _Connection * pConnection ) = 0; - virtual HRESULT __stdcall raw_ExecuteComplete ( - long RecordsAffected, - struct Error * pError, - enum EventStatusEnum * adStatus, - struct _Command * pCommand, - struct _Recordset * pRecordset, - struct _Connection * pConnection ) = 0; - virtual HRESULT __stdcall raw_WillConnect ( - BSTR * ConnectionString, - BSTR * UserID, - BSTR * Password, - long * Options, - enum EventStatusEnum * adStatus, - struct _Connection * pConnection ) = 0; - virtual HRESULT __stdcall raw_ConnectComplete ( - struct Error * pError, - enum EventStatusEnum * adStatus, - struct _Connection * pConnection ) = 0; - virtual HRESULT __stdcall raw_Disconnect ( - enum EventStatusEnum * adStatus, - struct _Connection * pConnection ) = 0; -}; - -struct __declspec(uuid("00000403-0000-0010-8000-00aa006d2ea4")) -RecordsetEventsVt : IUnknown -{ - // - // Wrapper methods for error-handling - // - - HRESULT WillChangeField ( - long cFields, - const _variant_t & Fields, - enum EventStatusEnum * adStatus, - struct _Recordset * pRecordset ); - HRESULT FieldChangeComplete ( - long cFields, - const _variant_t & Fields, - struct Error * pError, - enum EventStatusEnum * adStatus, - struct _Recordset * pRecordset ); - HRESULT WillChangeRecord ( - enum EventReasonEnum adReason, - long cRecords, - enum EventStatusEnum * adStatus, - struct _Recordset * pRecordset ); - HRESULT RecordChangeComplete ( - enum EventReasonEnum adReason, - long cRecords, - struct Error * pError, - enum EventStatusEnum * adStatus, - struct _Recordset * pRecordset ); - HRESULT WillChangeRecordset ( - enum EventReasonEnum adReason, - enum EventStatusEnum * adStatus, - struct _Recordset * pRecordset ); - HRESULT RecordsetChangeComplete ( - enum EventReasonEnum adReason, - struct Error * pError, - enum EventStatusEnum * adStatus, - struct _Recordset * pRecordset ); - HRESULT WillMove ( - enum EventReasonEnum adReason, - enum EventStatusEnum * adStatus, - struct _Recordset * pRecordset ); - HRESULT MoveComplete ( - enum EventReasonEnum adReason, - struct Error * pError, - enum EventStatusEnum * adStatus, - struct _Recordset * pRecordset ); - HRESULT EndOfRecordset ( - VARIANT_BOOL * fMoreData, - enum EventStatusEnum * adStatus, - struct _Recordset * pRecordset ); - HRESULT FetchProgress ( - long Progress, - long MaxProgress, - enum EventStatusEnum * adStatus, - struct _Recordset * pRecordset ); - HRESULT FetchComplete ( - struct Error * pError, - enum EventStatusEnum * adStatus, - struct _Recordset * pRecordset ); - - // - // Raw methods provided by interface - // - - virtual HRESULT __stdcall raw_WillChangeField ( - long cFields, - VARIANT Fields, - enum EventStatusEnum * adStatus, - struct _Recordset * pRecordset ) = 0; - virtual HRESULT __stdcall raw_FieldChangeComplete ( - long cFields, - VARIANT Fields, - struct Error * pError, - enum EventStatusEnum * adStatus, - struct _Recordset * pRecordset ) = 0; - virtual HRESULT __stdcall raw_WillChangeRecord ( - enum EventReasonEnum adReason, - long cRecords, - enum EventStatusEnum * adStatus, - struct _Recordset * pRecordset ) = 0; - virtual HRESULT __stdcall raw_RecordChangeComplete ( - enum EventReasonEnum adReason, - long cRecords, - struct Error * pError, - enum EventStatusEnum * adStatus, - struct _Recordset * pRecordset ) = 0; - virtual HRESULT __stdcall raw_WillChangeRecordset ( - enum EventReasonEnum adReason, - enum EventStatusEnum * adStatus, - struct _Recordset * pRecordset ) = 0; - virtual HRESULT __stdcall raw_RecordsetChangeComplete ( - enum EventReasonEnum adReason, - struct Error * pError, - enum EventStatusEnum * adStatus, - struct _Recordset * pRecordset ) = 0; - virtual HRESULT __stdcall raw_WillMove ( - enum EventReasonEnum adReason, - enum EventStatusEnum * adStatus, - struct _Recordset * pRecordset ) = 0; - virtual HRESULT __stdcall raw_MoveComplete ( - enum EventReasonEnum adReason, - struct Error * pError, - enum EventStatusEnum * adStatus, - struct _Recordset * pRecordset ) = 0; - virtual HRESULT __stdcall raw_EndOfRecordset ( - VARIANT_BOOL * fMoreData, - enum EventStatusEnum * adStatus, - struct _Recordset * pRecordset ) = 0; - virtual HRESULT __stdcall raw_FetchProgress ( - long Progress, - long MaxProgress, - enum EventStatusEnum * adStatus, - struct _Recordset * pRecordset ) = 0; - virtual HRESULT __stdcall raw_FetchComplete ( - struct Error * pError, - enum EventStatusEnum * adStatus, - struct _Recordset * pRecordset ) = 0; -}; - -struct __declspec(uuid("00000400-0000-0010-8000-00aa006d2ea4")) -ConnectionEvents : IDispatch -{ - // - // Wrapper methods for error-handling - // - - // Methods: - HRESULT InfoMessage ( - struct Error * pError, - enum EventStatusEnum * adStatus, - struct _Connection * pConnection ); - HRESULT BeginTransComplete ( - long TransactionLevel, - struct Error * pError, - enum EventStatusEnum * adStatus, - struct _Connection * pConnection ); - HRESULT CommitTransComplete ( - struct Error * pError, - enum EventStatusEnum * adStatus, - struct _Connection * pConnection ); - HRESULT RollbackTransComplete ( - struct Error * pError, - enum EventStatusEnum * adStatus, - struct _Connection * pConnection ); - HRESULT WillExecute ( - BSTR * Source, - enum CursorTypeEnum * CursorType, - enum LockTypeEnum * LockType, - long * Options, - enum EventStatusEnum * adStatus, - struct _Command * pCommand, - struct _Recordset * pRecordset, - struct _Connection * pConnection ); - HRESULT ExecuteComplete ( - long RecordsAffected, - struct Error * pError, - enum EventStatusEnum * adStatus, - struct _Command * pCommand, - struct _Recordset * pRecordset, - struct _Connection * pConnection ); - HRESULT WillConnect ( - BSTR * ConnectionString, - BSTR * UserID, - BSTR * Password, - long * Options, - enum EventStatusEnum * adStatus, - struct _Connection * pConnection ); - HRESULT ConnectComplete ( - struct Error * pError, - enum EventStatusEnum * adStatus, - struct _Connection * pConnection ); - HRESULT Disconnect ( - enum EventStatusEnum * adStatus, - struct _Connection * pConnection ); -}; - -struct __declspec(uuid("00000266-0000-0010-8000-00aa006d2ea4")) -RecordsetEvents : IDispatch -{ - // - // Wrapper methods for error-handling - // - - // Methods: - HRESULT WillChangeField ( - long cFields, - const _variant_t & Fields, - enum EventStatusEnum * adStatus, - struct _Recordset * pRecordset ); - HRESULT FieldChangeComplete ( - long cFields, - const _variant_t & Fields, - struct Error * pError, - enum EventStatusEnum * adStatus, - struct _Recordset * pRecordset ); - HRESULT WillChangeRecord ( - enum EventReasonEnum adReason, - long cRecords, - enum EventStatusEnum * adStatus, - struct _Recordset * pRecordset ); - HRESULT RecordChangeComplete ( - enum EventReasonEnum adReason, - long cRecords, - struct Error * pError, - enum EventStatusEnum * adStatus, - struct _Recordset * pRecordset ); - HRESULT WillChangeRecordset ( - enum EventReasonEnum adReason, - enum EventStatusEnum * adStatus, - struct _Recordset * pRecordset ); - HRESULT RecordsetChangeComplete ( - enum EventReasonEnum adReason, - struct Error * pError, - enum EventStatusEnum * adStatus, - struct _Recordset * pRecordset ); - HRESULT WillMove ( - enum EventReasonEnum adReason, - enum EventStatusEnum * adStatus, - struct _Recordset * pRecordset ); - HRESULT MoveComplete ( - enum EventReasonEnum adReason, - struct Error * pError, - enum EventStatusEnum * adStatus, - struct _Recordset * pRecordset ); - HRESULT EndOfRecordset ( - VARIANT_BOOL * fMoreData, - enum EventStatusEnum * adStatus, - struct _Recordset * pRecordset ); - HRESULT FetchProgress ( - long Progress, - long MaxProgress, - enum EventStatusEnum * adStatus, - struct _Recordset * pRecordset ); - HRESULT FetchComplete ( - struct Error * pError, - enum EventStatusEnum * adStatus, - struct _Recordset * pRecordset ); -}; - -struct __declspec(uuid("00000516-0000-0010-8000-00aa006d2ea4")) -ADOConnectionConstruction15 : IUnknown -{ - // - // Property data - // - - __declspec(property(get=GetDSO)) - IUnknownPtr DSO; - __declspec(property(get=GetSession)) - IUnknownPtr Session; - - // - // Wrapper methods for error-handling - // - - IUnknownPtr GetDSO ( ); - IUnknownPtr GetSession ( ); - HRESULT WrapDSOandSession ( - IUnknown * pDSO, - IUnknown * pSession ); - - // - // Raw methods provided by interface - // - - virtual HRESULT __stdcall get_DSO ( - IUnknown * * ppDSO ) = 0; - virtual HRESULT __stdcall get_Session ( - IUnknown * * ppSession ) = 0; - virtual HRESULT __stdcall raw_WrapDSOandSession ( - IUnknown * pDSO, - IUnknown * pSession ) = 0; -}; - -struct __declspec(uuid("00000551-0000-0010-8000-00aa006d2ea4")) -ADOConnectionConstruction : ADOConnectionConstruction15 -{}; - -struct __declspec(uuid("00000514-0000-0010-8000-00aa006d2ea4")) -Connection; - // [ default ] interface _Connection - // [ default, source ] dispinterface ConnectionEvents - -struct __declspec(uuid("00000562-0000-0010-8000-00aa006d2ea4")) -_Record : _ADO -{ - // - // Property data - // - - __declspec(property(get=GetFields)) - FieldsPtr Fields; - __declspec(property(get=GetState)) - enum ObjectStateEnum State; - __declspec(property(get=GetMode,put=PutMode)) - enum ConnectModeEnum Mode; - __declspec(property(get=GetParentURL)) - _bstr_t ParentURL; - __declspec(property(get=GetRecordType)) - enum RecordTypeEnum RecordType; - - // - // Wrapper methods for error-handling - // - - _variant_t GetActiveConnection ( ); - void PutActiveConnection ( - _bstr_t pvar ); - void PutRefActiveConnection ( - struct _Connection * pvar ); - enum ObjectStateEnum GetState ( ); - _variant_t GetSource ( ); - void PutSource ( - _bstr_t pvar ); - void PutRefSource ( - IDispatch * pvar ); - enum ConnectModeEnum GetMode ( ); - void PutMode ( - enum ConnectModeEnum pMode ); - _bstr_t GetParentURL ( ); - _bstr_t MoveRecord ( - _bstr_t Source, - _bstr_t Destination, - _bstr_t UserName, - _bstr_t Password, - enum MoveRecordOptionsEnum Options, - VARIANT_BOOL Async ); - _bstr_t CopyRecord ( - _bstr_t Source, - _bstr_t Destination, - _bstr_t UserName, - _bstr_t Password, - enum CopyRecordOptionsEnum Options, - VARIANT_BOOL Async ); - HRESULT DeleteRecord ( - _bstr_t Source, - VARIANT_BOOL Async ); - HRESULT Open ( - const _variant_t & Source, - const _variant_t & ActiveConnection, - enum ConnectModeEnum Mode, - enum RecordCreateOptionsEnum CreateOptions, - enum RecordOpenOptionsEnum Options, - _bstr_t UserName, - _bstr_t Password ); - HRESULT Close ( ); - FieldsPtr GetFields ( ); - enum RecordTypeEnum GetRecordType ( ); - _RecordsetPtr GetChildren ( ); - HRESULT Cancel ( ); - - // - // Raw methods provided by interface - // - - virtual HRESULT __stdcall get_ActiveConnection ( - VARIANT * pvar ) = 0; - virtual HRESULT __stdcall put_ActiveConnection ( - BSTR pvar ) = 0; - virtual HRESULT __stdcall putref_ActiveConnection ( - struct _Connection * pvar ) = 0; - virtual HRESULT __stdcall get_State ( - enum ObjectStateEnum * pState ) = 0; - virtual HRESULT __stdcall get_Source ( - VARIANT * pvar ) = 0; - virtual HRESULT __stdcall put_Source ( - BSTR pvar ) = 0; - virtual HRESULT __stdcall putref_Source ( - IDispatch * pvar ) = 0; - virtual HRESULT __stdcall get_Mode ( - enum ConnectModeEnum * pMode ) = 0; - virtual HRESULT __stdcall put_Mode ( - enum ConnectModeEnum pMode ) = 0; - virtual HRESULT __stdcall get_ParentURL ( - BSTR * pbstrParentURL ) = 0; - virtual HRESULT __stdcall raw_MoveRecord ( - BSTR Source, - BSTR Destination, - BSTR UserName, - BSTR Password, - enum MoveRecordOptionsEnum Options, - VARIANT_BOOL Async, - BSTR * pbstrNewURL ) = 0; - virtual HRESULT __stdcall raw_CopyRecord ( - BSTR Source, - BSTR Destination, - BSTR UserName, - BSTR Password, - enum CopyRecordOptionsEnum Options, - VARIANT_BOOL Async, - BSTR * pbstrNewURL ) = 0; - virtual HRESULT __stdcall raw_DeleteRecord ( - BSTR Source, - VARIANT_BOOL Async ) = 0; - virtual HRESULT __stdcall raw_Open ( - VARIANT Source, - VARIANT ActiveConnection, - enum ConnectModeEnum Mode, - enum RecordCreateOptionsEnum CreateOptions, - enum RecordOpenOptionsEnum Options, - BSTR UserName, - BSTR Password ) = 0; - virtual HRESULT __stdcall raw_Close ( ) = 0; - virtual HRESULT __stdcall get_Fields ( - struct Fields * * ppFlds ) = 0; - virtual HRESULT __stdcall get_RecordType ( - enum RecordTypeEnum * ptype ) = 0; - virtual HRESULT __stdcall raw_GetChildren ( - struct _Recordset * * pprset ) = 0; - virtual HRESULT __stdcall raw_Cancel ( ) = 0; -}; - -struct __declspec(uuid("00000560-0000-0010-8000-00aa006d2ea4")) -Record; - // [ default ] interface _Record - -struct __declspec(uuid("00000563-0000-0010-8000-00aa006d2ea4")) -IRecFields : IUnknown -{ - // - // Wrapper methods for error-handling - // - - HRESULT ADOCheck ( ); - - // - // Raw methods provided by interface - // - - virtual HRESULT __stdcall raw_ADOCheck ( ) = 0; -}; - -struct __declspec(uuid("00000565-0000-0010-8000-00aa006d2ea4")) -_Stream : IDispatch -{ - // - // Property data - // - - __declspec(property(get=GetSize)) - long Size; - __declspec(property(get=GetEOS)) - VARIANT_BOOL EOS; - __declspec(property(get=GetPosition,put=PutPosition)) - long Position; - __declspec(property(get=GetType,put=PutType)) - enum StreamTypeEnum Type; - __declspec(property(get=GetLineSeparator,put=PutLineSeparator)) - enum LineSeparatorEnum LineSeparator; - __declspec(property(get=GetState)) - enum ObjectStateEnum State; - __declspec(property(get=GetMode,put=PutMode)) - enum ConnectModeEnum Mode; - __declspec(property(get=GetCharset,put=PutCharset)) - _bstr_t Charset; - - // - // Wrapper methods for error-handling - // - - long GetSize ( ); - VARIANT_BOOL GetEOS ( ); - long GetPosition ( ); - void PutPosition ( - long pPos ); - enum StreamTypeEnum GetType ( ); - void PutType ( - enum StreamTypeEnum ptype ); - enum LineSeparatorEnum GetLineSeparator ( ); - void PutLineSeparator ( - enum LineSeparatorEnum pLS ); - enum ObjectStateEnum GetState ( ); - enum ConnectModeEnum GetMode ( ); - void PutMode ( - enum ConnectModeEnum pMode ); - _bstr_t GetCharset ( ); - void PutCharset ( - _bstr_t pbstrCharset ); - _variant_t Read ( - long NumBytes ); - HRESULT Open ( - const _variant_t & Source, - enum ConnectModeEnum Mode, - enum StreamOpenOptionsEnum Options, - _bstr_t UserName, - _bstr_t Password ); - HRESULT Close ( ); - HRESULT SkipLine ( ); - HRESULT Write ( - const _variant_t & Buffer ); - HRESULT SetEOS ( ); - HRESULT CopyTo ( - struct _Stream * DestStream, - long CharNumber ); - HRESULT Flush ( ); - HRESULT SaveToFile ( - _bstr_t FileName, - enum SaveOptionsEnum Options ); - HRESULT LoadFromFile ( - _bstr_t FileName ); - _bstr_t ReadText ( - long NumChars ); - HRESULT WriteText ( - _bstr_t Data, - enum StreamWriteEnum Options ); - HRESULT Cancel ( ); - - // - // Raw methods provided by interface - // - - virtual HRESULT __stdcall get_Size ( - long * pSize ) = 0; - virtual HRESULT __stdcall get_EOS ( - VARIANT_BOOL * pEOS ) = 0; - virtual HRESULT __stdcall get_Position ( - long * pPos ) = 0; - virtual HRESULT __stdcall put_Position ( - long pPos ) = 0; - virtual HRESULT __stdcall get_Type ( - enum StreamTypeEnum * ptype ) = 0; - virtual HRESULT __stdcall put_Type ( - enum StreamTypeEnum ptype ) = 0; - virtual HRESULT __stdcall get_LineSeparator ( - enum LineSeparatorEnum * pLS ) = 0; - virtual HRESULT __stdcall put_LineSeparator ( - enum LineSeparatorEnum pLS ) = 0; - virtual HRESULT __stdcall get_State ( - enum ObjectStateEnum * pState ) = 0; - virtual HRESULT __stdcall get_Mode ( - enum ConnectModeEnum * pMode ) = 0; - virtual HRESULT __stdcall put_Mode ( - enum ConnectModeEnum pMode ) = 0; - virtual HRESULT __stdcall get_Charset ( - BSTR * pbstrCharset ) = 0; - virtual HRESULT __stdcall put_Charset ( - BSTR pbstrCharset ) = 0; - virtual HRESULT __stdcall raw_Read ( - long NumBytes, - VARIANT * pval ) = 0; - virtual HRESULT __stdcall raw_Open ( - VARIANT Source, - enum ConnectModeEnum Mode, - enum StreamOpenOptionsEnum Options, - BSTR UserName, - BSTR Password ) = 0; - virtual HRESULT __stdcall raw_Close ( ) = 0; - virtual HRESULT __stdcall raw_SkipLine ( ) = 0; - virtual HRESULT __stdcall raw_Write ( - VARIANT Buffer ) = 0; - virtual HRESULT __stdcall raw_SetEOS ( ) = 0; - virtual HRESULT __stdcall raw_CopyTo ( - struct _Stream * DestStream, - long CharNumber ) = 0; - virtual HRESULT __stdcall raw_Flush ( ) = 0; - virtual HRESULT __stdcall raw_SaveToFile ( - BSTR FileName, - enum SaveOptionsEnum Options ) = 0; - virtual HRESULT __stdcall raw_LoadFromFile ( - BSTR FileName ) = 0; - virtual HRESULT __stdcall raw_ReadText ( - long NumChars, - BSTR * pbstr ) = 0; - virtual HRESULT __stdcall raw_WriteText ( - BSTR Data, - enum StreamWriteEnum Options ) = 0; - virtual HRESULT __stdcall raw_Cancel ( ) = 0; -}; - -struct __declspec(uuid("00000566-0000-0010-8000-00aa006d2ea4")) -Stream; - // [ default ] interface _Stream - -struct __declspec(uuid("00000567-0000-0010-8000-00aa006d2ea4")) -ADORecordConstruction : IDispatch -{ - // - // Property data - // - - __declspec(property(get=GetRow,put=PutRow)) - IUnknownPtr Row; - __declspec(property(put=PutParentRow)) - IUnknownPtr ParentRow; - - // - // Wrapper methods for error-handling - // - - IUnknownPtr GetRow ( ); - void PutRow ( - IUnknown * ppRow ); - void PutParentRow ( - IUnknown * _arg1 ); - - // - // Raw methods provided by interface - // - - virtual HRESULT __stdcall get_Row ( - IUnknown * * ppRow ) = 0; - virtual HRESULT __stdcall put_Row ( - IUnknown * ppRow ) = 0; - virtual HRESULT __stdcall put_ParentRow ( - IUnknown * _arg1 ) = 0; -}; - -struct __declspec(uuid("00000568-0000-0010-8000-00aa006d2ea4")) -ADOStreamConstruction : IDispatch -{ - // - // Property data - // - - __declspec(property(get=GetStream,put=PutStream)) - IUnknownPtr Stream; - - // - // Wrapper methods for error-handling - // - - IUnknownPtr GetStream ( ); - void PutStream ( - IUnknown * ppStm ); - - // - // Raw methods provided by interface - // - - virtual HRESULT __stdcall get_Stream ( - IUnknown * * ppStm ) = 0; - virtual HRESULT __stdcall put_Stream ( - IUnknown * ppStm ) = 0; -}; - -struct __declspec(uuid("00000517-0000-0010-8000-00aa006d2ea4")) -ADOCommandConstruction : IUnknown -{ - // - // Property data - // - - __declspec(property(get=GetOLEDBCommand,put=PutOLEDBCommand)) - IUnknownPtr OLEDBCommand; - - // - // Wrapper methods for error-handling - // - - IUnknownPtr GetOLEDBCommand ( ); - void PutOLEDBCommand ( - IUnknown * ppOLEDBCommand ); - - // - // Raw methods provided by interface - // - - virtual HRESULT __stdcall get_OLEDBCommand ( - IUnknown * * ppOLEDBCommand ) = 0; - virtual HRESULT __stdcall put_OLEDBCommand ( - IUnknown * ppOLEDBCommand ) = 0; -}; - -struct __declspec(uuid("00000507-0000-0010-8000-00aa006d2ea4")) -Command; - // [ default ] interface _Command - -struct __declspec(uuid("00000535-0000-0010-8000-00aa006d2ea4")) -Recordset; - // [ default ] interface _Recordset - // [ default, source ] dispinterface RecordsetEvents - -struct __declspec(uuid("00000283-0000-0010-8000-00aa006d2ea4")) -ADORecordsetConstruction : IDispatch -{ - // - // Property data - // - - __declspec(property(get=GetRowset,put=PutRowset)) - IUnknownPtr Rowset; - __declspec(property(get=GetChapter,put=PutChapter)) - long Chapter; - __declspec(property(get=GetRowPosition,put=PutRowPosition)) - IUnknownPtr RowPosition; - - // - // Wrapper methods for error-handling - // - - IUnknownPtr GetRowset ( ); - void PutRowset ( - IUnknown * ppRowset ); - long GetChapter ( ); - void PutChapter ( - long plChapter ); - IUnknownPtr GetRowPosition ( ); - void PutRowPosition ( - IUnknown * ppRowPos ); - - // - // Raw methods provided by interface - // - - virtual HRESULT __stdcall get_Rowset ( - IUnknown * * ppRowset ) = 0; - virtual HRESULT __stdcall put_Rowset ( - IUnknown * ppRowset ) = 0; - virtual HRESULT __stdcall get_Chapter ( - long * plChapter ) = 0; - virtual HRESULT __stdcall put_Chapter ( - long plChapter ) = 0; - virtual HRESULT __stdcall get_RowPosition ( - IUnknown * * ppRowPos ) = 0; - virtual HRESULT __stdcall put_RowPosition ( - IUnknown * ppRowPos ) = 0; -}; - -struct __declspec(uuid("00000505-0000-0010-8000-00aa006d2ea4")) -Field15 : _ADO -{ - // - // Property data - // - - __declspec(property(get=GetValue,put=PutValue)) - _variant_t Value; - __declspec(property(get=GetName)) - _bstr_t Name; - __declspec(property(get=GetType)) - enum DataTypeEnum Type; - __declspec(property(get=GetDefinedSize)) - long DefinedSize; - __declspec(property(get=GetOriginalValue)) - _variant_t OriginalValue; - __declspec(property(get=GetUnderlyingValue)) - _variant_t UnderlyingValue; - __declspec(property(get=GetActualSize)) - long ActualSize; - __declspec(property(get=GetPrecision)) - unsigned char Precision; - __declspec(property(get=GetNumericScale)) - unsigned char NumericScale; - __declspec(property(get=GetAttributes)) - long Attributes; - - // - // Wrapper methods for error-handling - // - - long GetActualSize ( ); - long GetAttributes ( ); - long GetDefinedSize ( ); - _bstr_t GetName ( ); - enum DataTypeEnum GetType ( ); - _variant_t GetValue ( ); - void PutValue ( - const _variant_t & pvar ); - unsigned char GetPrecision ( ); - unsigned char GetNumericScale ( ); - HRESULT AppendChunk ( - const _variant_t & Data ); - _variant_t GetChunk ( - long Length ); - _variant_t GetOriginalValue ( ); - _variant_t GetUnderlyingValue ( ); - - // - // Raw methods provided by interface - // - - virtual HRESULT __stdcall get_ActualSize ( - long * pl ) = 0; - virtual HRESULT __stdcall get_Attributes ( - long * pl ) = 0; - virtual HRESULT __stdcall get_DefinedSize ( - long * pl ) = 0; - virtual HRESULT __stdcall get_Name ( - BSTR * pbstr ) = 0; - virtual HRESULT __stdcall get_Type ( - enum DataTypeEnum * pDataType ) = 0; - virtual HRESULT __stdcall get_Value ( - VARIANT * pvar ) = 0; - virtual HRESULT __stdcall put_Value ( - VARIANT pvar ) = 0; - virtual HRESULT __stdcall get_Precision ( - unsigned char * pbPrecision ) = 0; - virtual HRESULT __stdcall get_NumericScale ( - unsigned char * pbNumericScale ) = 0; - virtual HRESULT __stdcall raw_AppendChunk ( - VARIANT Data ) = 0; - virtual HRESULT __stdcall raw_GetChunk ( - long Length, - VARIANT * pvar ) = 0; - virtual HRESULT __stdcall get_OriginalValue ( - VARIANT * pvar ) = 0; - virtual HRESULT __stdcall get_UnderlyingValue ( - VARIANT * pvar ) = 0; -}; - -struct __declspec(uuid("0000050b-0000-0010-8000-00aa006d2ea4")) -Parameter; - // [ default ] interface _Parameter - -// -// Wrapper method implementations -// - -#include "msado15.tli" - -} // namespace ADODB - -#pragma pack(pop) diff --git a/st2gpx/src/msado15.tli b/st2gpx/src/msado15.tli deleted file mode 100644 index e72d7a8c0..000000000 --- a/st2gpx/src/msado15.tli +++ /dev/null @@ -1,2095 +0,0 @@ -// Created by Microsoft (R) C/C++ Compiler Version 12.00.8168.0 (1f62c7b3). -// -// msado15.tli -// -// Wrapper implementations for Win32 type library msado15.dll -// compiler-generated file created 11/21/03 at 18:38:05 - DO NOT EDIT! - -#pragma once - -// -// interface _Collection wrapper method implementations -// - -inline long _Collection::GetCount ( ) { - long _result; - HRESULT _hr = get_Count(&_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _result; -} - -inline IUnknownPtr _Collection::_NewEnum ( ) { - IUnknown * _result; - HRESULT _hr = raw__NewEnum(&_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return IUnknownPtr(_result, false); -} - -inline HRESULT _Collection::Refresh ( ) { - HRESULT _hr = raw_Refresh(); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _hr; -} - -// -// interface _DynaCollection wrapper method implementations -// - -inline HRESULT _DynaCollection::Append ( IDispatch * Object ) { - HRESULT _hr = raw_Append(Object); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _hr; -} - -inline HRESULT _DynaCollection::Delete ( const _variant_t & Index ) { - HRESULT _hr = raw_Delete(Index); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _hr; -} - -// -// interface _ADO wrapper method implementations -// - -inline PropertiesPtr _ADO::GetProperties ( ) { - struct Properties * _result; - HRESULT _hr = get_Properties(&_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return PropertiesPtr(_result, false); -} - -// -// interface Properties wrapper method implementations -// - -inline PropertyPtr Properties::GetItem ( const _variant_t & Index ) { - struct Property * _result; - HRESULT _hr = get_Item(Index, &_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return PropertyPtr(_result, false); -} - -// -// interface Property wrapper method implementations -// - -inline _variant_t Property::GetValue ( ) { - VARIANT _result; - VariantInit(&_result); - HRESULT _hr = get_Value(&_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _variant_t(_result, false); -} - -inline void Property::PutValue ( const _variant_t & pval ) { - HRESULT _hr = put_Value(pval); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); -} - -inline _bstr_t Property::GetName ( ) { - BSTR _result; - HRESULT _hr = get_Name(&_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _bstr_t(_result, false); -} - -inline enum DataTypeEnum Property::GetType ( ) { - enum DataTypeEnum _result; - HRESULT _hr = get_Type(&_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _result; -} - -inline long Property::GetAttributes ( ) { - long _result; - HRESULT _hr = get_Attributes(&_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _result; -} - -inline void Property::PutAttributes ( long plAttributes ) { - HRESULT _hr = put_Attributes(plAttributes); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); -} - -// -// interface Error wrapper method implementations -// - -inline long Error::GetNumber ( ) { - long _result; - HRESULT _hr = get_Number(&_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _result; -} - -inline _bstr_t Error::GetSource ( ) { - BSTR _result; - HRESULT _hr = get_Source(&_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _bstr_t(_result, false); -} - -inline _bstr_t Error::GetDescription ( ) { - BSTR _result; - HRESULT _hr = get_Description(&_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _bstr_t(_result, false); -} - -inline _bstr_t Error::GetHelpFile ( ) { - BSTR _result; - HRESULT _hr = get_HelpFile(&_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _bstr_t(_result, false); -} - -inline long Error::GetHelpContext ( ) { - long _result; - HRESULT _hr = get_HelpContext(&_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _result; -} - -inline _bstr_t Error::GetSQLState ( ) { - BSTR _result; - HRESULT _hr = get_SQLState(&_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _bstr_t(_result, false); -} - -inline long Error::GetNativeError ( ) { - long _result; - HRESULT _hr = get_NativeError(&_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _result; -} - -// -// interface Errors wrapper method implementations -// - -inline ErrorPtr Errors::GetItem ( const _variant_t & Index ) { - struct Error * _result; - HRESULT _hr = get_Item(Index, &_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return ErrorPtr(_result, false); -} - -inline HRESULT Errors::Clear ( ) { - HRESULT _hr = raw_Clear(); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _hr; -} - -// -// interface Command15 wrapper method implementations -// - -inline _ConnectionPtr Command15::GetActiveConnection ( ) { - struct _Connection * _result; - HRESULT _hr = get_ActiveConnection(&_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _ConnectionPtr(_result, false); -} - -inline void Command15::PutRefActiveConnection ( struct _Connection * ppvObject ) { - HRESULT _hr = putref_ActiveConnection(ppvObject); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); -} - -inline void Command15::PutActiveConnection ( const _variant_t & ppvObject ) { - HRESULT _hr = put_ActiveConnection(ppvObject); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); -} - -inline _bstr_t Command15::GetCommandText ( ) { - BSTR _result; - HRESULT _hr = get_CommandText(&_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _bstr_t(_result, false); -} - -inline void Command15::PutCommandText ( _bstr_t pbstr ) { - HRESULT _hr = put_CommandText(pbstr); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); -} - -inline long Command15::GetCommandTimeout ( ) { - long _result; - HRESULT _hr = get_CommandTimeout(&_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _result; -} - -inline void Command15::PutCommandTimeout ( long pl ) { - HRESULT _hr = put_CommandTimeout(pl); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); -} - -inline VARIANT_BOOL Command15::GetPrepared ( ) { - VARIANT_BOOL _result; - HRESULT _hr = get_Prepared(&_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _result; -} - -inline void Command15::PutPrepared ( VARIANT_BOOL pfPrepared ) { - HRESULT _hr = put_Prepared(pfPrepared); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); -} - -inline _RecordsetPtr Command15::Execute ( VARIANT * RecordsAffected, VARIANT * Parameters, long Options ) { - struct _Recordset * _result; - HRESULT _hr = raw_Execute(RecordsAffected, Parameters, Options, &_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _RecordsetPtr(_result, false); -} - -inline _ParameterPtr Command15::CreateParameter ( _bstr_t Name, enum DataTypeEnum Type, enum ParameterDirectionEnum Direction, long Size, const _variant_t & Value ) { - struct _Parameter * _result; - HRESULT _hr = raw_CreateParameter(Name, Type, Direction, Size, Value, &_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _ParameterPtr(_result, false); -} - -inline ParametersPtr Command15::GetParameters ( ) { - struct Parameters * _result; - HRESULT _hr = get_Parameters(&_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return ParametersPtr(_result, false); -} - -inline void Command15::PutCommandType ( enum CommandTypeEnum plCmdType ) { - HRESULT _hr = put_CommandType(plCmdType); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); -} - -inline enum CommandTypeEnum Command15::GetCommandType ( ) { - enum CommandTypeEnum _result; - HRESULT _hr = get_CommandType(&_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _result; -} - -inline _bstr_t Command15::GetName ( ) { - BSTR _result; - HRESULT _hr = get_Name(&_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _bstr_t(_result, false); -} - -inline void Command15::PutName ( _bstr_t pbstrName ) { - HRESULT _hr = put_Name(pbstrName); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); -} - -// -// interface Connection15 wrapper method implementations -// - -inline _bstr_t Connection15::GetConnectionString ( ) { - BSTR _result; - HRESULT _hr = get_ConnectionString(&_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _bstr_t(_result, false); -} - -inline void Connection15::PutConnectionString ( _bstr_t pbstr ) { - HRESULT _hr = put_ConnectionString(pbstr); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); -} - -inline long Connection15::GetCommandTimeout ( ) { - long _result; - HRESULT _hr = get_CommandTimeout(&_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _result; -} - -inline void Connection15::PutCommandTimeout ( long plTimeout ) { - HRESULT _hr = put_CommandTimeout(plTimeout); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); -} - -inline long Connection15::GetConnectionTimeout ( ) { - long _result; - HRESULT _hr = get_ConnectionTimeout(&_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _result; -} - -inline void Connection15::PutConnectionTimeout ( long plTimeout ) { - HRESULT _hr = put_ConnectionTimeout(plTimeout); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); -} - -inline _bstr_t Connection15::GetVersion ( ) { - BSTR _result; - HRESULT _hr = get_Version(&_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _bstr_t(_result, false); -} - -inline HRESULT Connection15::Close ( ) { - HRESULT _hr = raw_Close(); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _hr; -} - -inline _RecordsetPtr Connection15::Execute ( _bstr_t CommandText, VARIANT * RecordsAffected, long Options ) { - struct _Recordset * _result; - HRESULT _hr = raw_Execute(CommandText, RecordsAffected, Options, &_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _RecordsetPtr(_result, false); -} - -inline long Connection15::BeginTrans ( ) { - long _result; - HRESULT _hr = raw_BeginTrans(&_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _result; -} - -inline HRESULT Connection15::CommitTrans ( ) { - HRESULT _hr = raw_CommitTrans(); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _hr; -} - -inline HRESULT Connection15::RollbackTrans ( ) { - HRESULT _hr = raw_RollbackTrans(); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _hr; -} - -inline HRESULT Connection15::Open ( _bstr_t ConnectionString, _bstr_t UserID, _bstr_t Password, long Options ) { - HRESULT _hr = raw_Open(ConnectionString, UserID, Password, Options); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _hr; -} - -inline ErrorsPtr Connection15::GetErrors ( ) { - struct Errors * _result; - HRESULT _hr = get_Errors(&_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return ErrorsPtr(_result, false); -} - -inline _bstr_t Connection15::GetDefaultDatabase ( ) { - BSTR _result; - HRESULT _hr = get_DefaultDatabase(&_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _bstr_t(_result, false); -} - -inline void Connection15::PutDefaultDatabase ( _bstr_t pbstr ) { - HRESULT _hr = put_DefaultDatabase(pbstr); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); -} - -inline enum IsolationLevelEnum Connection15::GetIsolationLevel ( ) { - enum IsolationLevelEnum _result; - HRESULT _hr = get_IsolationLevel(&_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _result; -} - -inline void Connection15::PutIsolationLevel ( enum IsolationLevelEnum Level ) { - HRESULT _hr = put_IsolationLevel(Level); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); -} - -inline long Connection15::GetAttributes ( ) { - long _result; - HRESULT _hr = get_Attributes(&_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _result; -} - -inline void Connection15::PutAttributes ( long plAttr ) { - HRESULT _hr = put_Attributes(plAttr); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); -} - -inline enum CursorLocationEnum Connection15::GetCursorLocation ( ) { - enum CursorLocationEnum _result; - HRESULT _hr = get_CursorLocation(&_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _result; -} - -inline void Connection15::PutCursorLocation ( enum CursorLocationEnum plCursorLoc ) { - HRESULT _hr = put_CursorLocation(plCursorLoc); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); -} - -inline enum ConnectModeEnum Connection15::GetMode ( ) { - enum ConnectModeEnum _result; - HRESULT _hr = get_Mode(&_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _result; -} - -inline void Connection15::PutMode ( enum ConnectModeEnum plMode ) { - HRESULT _hr = put_Mode(plMode); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); -} - -inline _bstr_t Connection15::GetProvider ( ) { - BSTR _result; - HRESULT _hr = get_Provider(&_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _bstr_t(_result, false); -} - -inline void Connection15::PutProvider ( _bstr_t pbstr ) { - HRESULT _hr = put_Provider(pbstr); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); -} - -inline long Connection15::GetState ( ) { - long _result; - HRESULT _hr = get_State(&_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _result; -} - -inline _RecordsetPtr Connection15::OpenSchema ( enum SchemaEnum Schema, const _variant_t & Restrictions, const _variant_t & SchemaID ) { - struct _Recordset * _result; - HRESULT _hr = raw_OpenSchema(Schema, Restrictions, SchemaID, &_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _RecordsetPtr(_result, false); -} - -// -// interface _Connection wrapper method implementations -// - -inline HRESULT _Connection::Cancel ( ) { - HRESULT _hr = raw_Cancel(); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _hr; -} - -// -// interface Recordset15 wrapper method implementations -// - -inline enum PositionEnum Recordset15::GetAbsolutePosition ( ) { - enum PositionEnum _result; - HRESULT _hr = get_AbsolutePosition(&_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _result; -} - -inline void Recordset15::PutAbsolutePosition ( enum PositionEnum pl ) { - HRESULT _hr = put_AbsolutePosition(pl); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); -} - -inline void Recordset15::PutRefActiveConnection ( IDispatch * pvar ) { - HRESULT _hr = putref_ActiveConnection(pvar); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); -} - -inline void Recordset15::PutActiveConnection ( const _variant_t & pvar ) { - HRESULT _hr = put_ActiveConnection(pvar); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); -} - -inline _variant_t Recordset15::GetActiveConnection ( ) { - VARIANT _result; - VariantInit(&_result); - HRESULT _hr = get_ActiveConnection(&_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _variant_t(_result, false); -} - -inline VARIANT_BOOL Recordset15::GetBOF ( ) { - VARIANT_BOOL _result; - HRESULT _hr = get_BOF(&_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _result; -} - -inline _variant_t Recordset15::GetBookmark ( ) { - VARIANT _result; - VariantInit(&_result); - HRESULT _hr = get_Bookmark(&_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _variant_t(_result, false); -} - -inline void Recordset15::PutBookmark ( const _variant_t & pvBookmark ) { - HRESULT _hr = put_Bookmark(pvBookmark); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); -} - -inline long Recordset15::GetCacheSize ( ) { - long _result; - HRESULT _hr = get_CacheSize(&_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _result; -} - -inline void Recordset15::PutCacheSize ( long pl ) { - HRESULT _hr = put_CacheSize(pl); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); -} - -inline enum CursorTypeEnum Recordset15::GetCursorType ( ) { - enum CursorTypeEnum _result; - HRESULT _hr = get_CursorType(&_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _result; -} - -inline void Recordset15::PutCursorType ( enum CursorTypeEnum plCursorType ) { - HRESULT _hr = put_CursorType(plCursorType); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); -} - -inline VARIANT_BOOL Recordset15::GetadoEOF ( ) { - VARIANT_BOOL _result; - HRESULT _hr = get_adoEOF(&_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _result; -} - -inline FieldsPtr Recordset15::GetFields ( ) { - struct Fields * _result; - HRESULT _hr = get_Fields(&_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return FieldsPtr(_result, false); -} - -inline enum LockTypeEnum Recordset15::GetLockType ( ) { - enum LockTypeEnum _result; - HRESULT _hr = get_LockType(&_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _result; -} - -inline void Recordset15::PutLockType ( enum LockTypeEnum plLockType ) { - HRESULT _hr = put_LockType(plLockType); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); -} - -inline long Recordset15::GetMaxRecords ( ) { - long _result; - HRESULT _hr = get_MaxRecords(&_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _result; -} - -inline void Recordset15::PutMaxRecords ( long plMaxRecords ) { - HRESULT _hr = put_MaxRecords(plMaxRecords); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); -} - -inline long Recordset15::GetRecordCount ( ) { - long _result; - HRESULT _hr = get_RecordCount(&_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _result; -} - -inline void Recordset15::PutRefSource ( IDispatch * pvSource ) { - HRESULT _hr = putref_Source(pvSource); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); -} - -inline void Recordset15::PutSource ( _bstr_t pvSource ) { - HRESULT _hr = put_Source(pvSource); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); -} - -inline _variant_t Recordset15::GetSource ( ) { - VARIANT _result; - VariantInit(&_result); - HRESULT _hr = get_Source(&_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _variant_t(_result, false); -} - -inline HRESULT Recordset15::AddNew ( const _variant_t & FieldList, const _variant_t & Values ) { - HRESULT _hr = raw_AddNew(FieldList, Values); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _hr; -} - -inline HRESULT Recordset15::CancelUpdate ( ) { - HRESULT _hr = raw_CancelUpdate(); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _hr; -} - -inline HRESULT Recordset15::Close ( ) { - HRESULT _hr = raw_Close(); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _hr; -} - -inline HRESULT Recordset15::Delete ( enum AffectEnum AffectRecords ) { - HRESULT _hr = raw_Delete(AffectRecords); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _hr; -} - -inline _variant_t Recordset15::GetRows ( long Rows, const _variant_t & Start, const _variant_t & Fields ) { - VARIANT _result; - VariantInit(&_result); - HRESULT _hr = raw_GetRows(Rows, Start, Fields, &_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _variant_t(_result, false); -} - -inline HRESULT Recordset15::Move ( long NumRecords, const _variant_t & Start ) { - HRESULT _hr = raw_Move(NumRecords, Start); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _hr; -} - -inline HRESULT Recordset15::MoveNext ( ) { - HRESULT _hr = raw_MoveNext(); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _hr; -} - -inline HRESULT Recordset15::MovePrevious ( ) { - HRESULT _hr = raw_MovePrevious(); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _hr; -} - -inline HRESULT Recordset15::MoveFirst ( ) { - HRESULT _hr = raw_MoveFirst(); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _hr; -} - -inline HRESULT Recordset15::MoveLast ( ) { - HRESULT _hr = raw_MoveLast(); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _hr; -} - -inline HRESULT Recordset15::Open ( const _variant_t & Source, const _variant_t & ActiveConnection, enum CursorTypeEnum CursorType, enum LockTypeEnum LockType, long Options ) { - HRESULT _hr = raw_Open(Source, ActiveConnection, CursorType, LockType, Options); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _hr; -} - -inline HRESULT Recordset15::Requery ( long Options ) { - HRESULT _hr = raw_Requery(Options); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _hr; -} - -inline HRESULT Recordset15::_xResync ( enum AffectEnum AffectRecords ) { - HRESULT _hr = raw__xResync(AffectRecords); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _hr; -} - -inline HRESULT Recordset15::Update ( const _variant_t & Fields, const _variant_t & Values ) { - HRESULT _hr = raw_Update(Fields, Values); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _hr; -} - -inline enum PositionEnum Recordset15::GetAbsolutePage ( ) { - enum PositionEnum _result; - HRESULT _hr = get_AbsolutePage(&_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _result; -} - -inline void Recordset15::PutAbsolutePage ( enum PositionEnum pl ) { - HRESULT _hr = put_AbsolutePage(pl); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); -} - -inline enum EditModeEnum Recordset15::GetEditMode ( ) { - enum EditModeEnum _result; - HRESULT _hr = get_EditMode(&_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _result; -} - -inline _variant_t Recordset15::GetFilter ( ) { - VARIANT _result; - VariantInit(&_result); - HRESULT _hr = get_Filter(&_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _variant_t(_result, false); -} - -inline void Recordset15::PutFilter ( const _variant_t & Criteria ) { - HRESULT _hr = put_Filter(Criteria); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); -} - -inline long Recordset15::GetPageCount ( ) { - long _result; - HRESULT _hr = get_PageCount(&_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _result; -} - -inline long Recordset15::GetPageSize ( ) { - long _result; - HRESULT _hr = get_PageSize(&_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _result; -} - -inline void Recordset15::PutPageSize ( long pl ) { - HRESULT _hr = put_PageSize(pl); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); -} - -inline _bstr_t Recordset15::GetSort ( ) { - BSTR _result; - HRESULT _hr = get_Sort(&_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _bstr_t(_result, false); -} - -inline void Recordset15::PutSort ( _bstr_t Criteria ) { - HRESULT _hr = put_Sort(Criteria); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); -} - -inline long Recordset15::GetStatus ( ) { - long _result; - HRESULT _hr = get_Status(&_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _result; -} - -inline long Recordset15::GetState ( ) { - long _result; - HRESULT _hr = get_State(&_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _result; -} - -inline _RecordsetPtr Recordset15::_xClone ( ) { - struct _Recordset * _result; - HRESULT _hr = raw__xClone(&_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _RecordsetPtr(_result, false); -} - -inline HRESULT Recordset15::UpdateBatch ( enum AffectEnum AffectRecords ) { - HRESULT _hr = raw_UpdateBatch(AffectRecords); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _hr; -} - -inline HRESULT Recordset15::CancelBatch ( enum AffectEnum AffectRecords ) { - HRESULT _hr = raw_CancelBatch(AffectRecords); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _hr; -} - -inline enum CursorLocationEnum Recordset15::GetCursorLocation ( ) { - enum CursorLocationEnum _result; - HRESULT _hr = get_CursorLocation(&_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _result; -} - -inline void Recordset15::PutCursorLocation ( enum CursorLocationEnum plCursorLoc ) { - HRESULT _hr = put_CursorLocation(plCursorLoc); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); -} - -inline _RecordsetPtr Recordset15::NextRecordset ( VARIANT * RecordsAffected ) { - struct _Recordset * _result; - HRESULT _hr = raw_NextRecordset(RecordsAffected, &_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _RecordsetPtr(_result, false); -} - -inline VARIANT_BOOL Recordset15::Supports ( enum CursorOptionEnum CursorOptions ) { - VARIANT_BOOL _result; - HRESULT _hr = raw_Supports(CursorOptions, &_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _result; -} - -inline _variant_t Recordset15::GetCollect ( const _variant_t & Index ) { - VARIANT _result; - VariantInit(&_result); - HRESULT _hr = get_Collect(Index, &_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _variant_t(_result, false); -} - -inline void Recordset15::PutCollect ( const _variant_t & Index, const _variant_t & pvar ) { - HRESULT _hr = put_Collect(Index, pvar); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); -} - -inline enum MarshalOptionsEnum Recordset15::GetMarshalOptions ( ) { - enum MarshalOptionsEnum _result; - HRESULT _hr = get_MarshalOptions(&_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _result; -} - -inline void Recordset15::PutMarshalOptions ( enum MarshalOptionsEnum peMarshal ) { - HRESULT _hr = put_MarshalOptions(peMarshal); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); -} - -inline HRESULT Recordset15::Find ( _bstr_t Criteria, long SkipRecords, enum SearchDirectionEnum SearchDirection, const _variant_t & Start ) { - HRESULT _hr = raw_Find(Criteria, SkipRecords, SearchDirection, Start); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _hr; -} - -// -// interface Recordset20 wrapper method implementations -// - -inline HRESULT Recordset20::Cancel ( ) { - HRESULT _hr = raw_Cancel(); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _hr; -} - -inline IUnknownPtr Recordset20::GetDataSource ( ) { - IUnknown * _result; - HRESULT _hr = get_DataSource(&_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return IUnknownPtr(_result, false); -} - -inline void Recordset20::PutRefDataSource ( IUnknown * ppunkDataSource ) { - HRESULT _hr = putref_DataSource(ppunkDataSource); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); -} - -inline HRESULT Recordset20::_xSave ( _bstr_t FileName, enum PersistFormatEnum PersistFormat ) { - HRESULT _hr = raw__xSave(FileName, PersistFormat); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _hr; -} - -inline IDispatchPtr Recordset20::GetActiveCommand ( ) { - IDispatch * _result; - HRESULT _hr = get_ActiveCommand(&_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return IDispatchPtr(_result, false); -} - -inline void Recordset20::PutStayInSync ( VARIANT_BOOL pbStayInSync ) { - HRESULT _hr = put_StayInSync(pbStayInSync); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); -} - -inline VARIANT_BOOL Recordset20::GetStayInSync ( ) { - VARIANT_BOOL _result; - HRESULT _hr = get_StayInSync(&_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _result; -} - -inline _bstr_t Recordset20::GetString ( enum StringFormatEnum StringFormat, long NumRows, _bstr_t ColumnDelimeter, _bstr_t RowDelimeter, _bstr_t NullExpr ) { - BSTR _result; - HRESULT _hr = raw_GetString(StringFormat, NumRows, ColumnDelimeter, RowDelimeter, NullExpr, &_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _bstr_t(_result, false); -} - -inline _bstr_t Recordset20::GetDataMember ( ) { - BSTR _result; - HRESULT _hr = get_DataMember(&_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _bstr_t(_result, false); -} - -inline void Recordset20::PutDataMember ( _bstr_t pbstrDataMember ) { - HRESULT _hr = put_DataMember(pbstrDataMember); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); -} - -inline enum CompareEnum Recordset20::CompareBookmarks ( const _variant_t & Bookmark1, const _variant_t & Bookmark2 ) { - enum CompareEnum _result; - HRESULT _hr = raw_CompareBookmarks(Bookmark1, Bookmark2, &_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _result; -} - -inline _RecordsetPtr Recordset20::Clone ( enum LockTypeEnum LockType ) { - struct _Recordset * _result; - HRESULT _hr = raw_Clone(LockType, &_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _RecordsetPtr(_result, false); -} - -inline HRESULT Recordset20::Resync ( enum AffectEnum AffectRecords, enum ResyncEnum ResyncValues ) { - HRESULT _hr = raw_Resync(AffectRecords, ResyncValues); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _hr; -} - -// -// interface Recordset21 wrapper method implementations -// - -inline HRESULT Recordset21::Seek ( const _variant_t & KeyValues, enum SeekEnum SeekOption ) { - HRESULT _hr = raw_Seek(KeyValues, SeekOption); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _hr; -} - -inline void Recordset21::PutIndex ( _bstr_t pbstrIndex ) { - HRESULT _hr = put_Index(pbstrIndex); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); -} - -inline _bstr_t Recordset21::GetIndex ( ) { - BSTR _result; - HRESULT _hr = get_Index(&_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _bstr_t(_result, false); -} - -// -// interface _Recordset wrapper method implementations -// - -inline HRESULT _Recordset::Save ( const _variant_t & Destination, enum PersistFormatEnum PersistFormat ) { - HRESULT _hr = raw_Save(Destination, PersistFormat); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _hr; -} - -// -// interface Fields15 wrapper method implementations -// - -inline FieldPtr Fields15::GetItem ( const _variant_t & Index ) { - struct Field * _result; - HRESULT _hr = get_Item(Index, &_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return FieldPtr(_result, false); -} - -// -// interface Fields20 wrapper method implementations -// - -inline HRESULT Fields20::_Append ( _bstr_t Name, enum DataTypeEnum Type, long DefinedSize, enum FieldAttributeEnum Attrib ) { - HRESULT _hr = raw__Append(Name, Type, DefinedSize, Attrib); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _hr; -} - -inline HRESULT Fields20::Delete ( const _variant_t & Index ) { - HRESULT _hr = raw_Delete(Index); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _hr; -} - -// -// interface Fields wrapper method implementations -// - -inline HRESULT Fields::Append ( _bstr_t Name, enum DataTypeEnum Type, long DefinedSize, enum FieldAttributeEnum Attrib, const _variant_t & FieldValue ) { - HRESULT _hr = raw_Append(Name, Type, DefinedSize, Attrib, FieldValue); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _hr; -} - -inline HRESULT Fields::Update ( ) { - HRESULT _hr = raw_Update(); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _hr; -} - -inline HRESULT Fields::Resync ( enum ResyncEnum ResyncValues ) { - HRESULT _hr = raw_Resync(ResyncValues); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _hr; -} - -inline HRESULT Fields::CancelUpdate ( ) { - HRESULT _hr = raw_CancelUpdate(); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _hr; -} - -// -// interface Field20 wrapper method implementations -// - -inline long Field20::GetActualSize ( ) { - long _result; - HRESULT _hr = get_ActualSize(&_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _result; -} - -inline long Field20::GetAttributes ( ) { - long _result; - HRESULT _hr = get_Attributes(&_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _result; -} - -inline long Field20::GetDefinedSize ( ) { - long _result; - HRESULT _hr = get_DefinedSize(&_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _result; -} - -inline _bstr_t Field20::GetName ( ) { - BSTR _result; - HRESULT _hr = get_Name(&_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _bstr_t(_result, false); -} - -inline enum DataTypeEnum Field20::GetType ( ) { - enum DataTypeEnum _result; - HRESULT _hr = get_Type(&_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _result; -} - -inline _variant_t Field20::GetValue ( ) { - VARIANT _result; - VariantInit(&_result); - HRESULT _hr = get_Value(&_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _variant_t(_result, false); -} - -inline void Field20::PutValue ( const _variant_t & pvar ) { - HRESULT _hr = put_Value(pvar); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); -} - -inline unsigned char Field20::GetPrecision ( ) { - unsigned char _result; - HRESULT _hr = get_Precision(&_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _result; -} - -inline unsigned char Field20::GetNumericScale ( ) { - unsigned char _result; - HRESULT _hr = get_NumericScale(&_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _result; -} - -inline HRESULT Field20::AppendChunk ( const _variant_t & Data ) { - HRESULT _hr = raw_AppendChunk(Data); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _hr; -} - -inline _variant_t Field20::GetChunk ( long Length ) { - VARIANT _result; - VariantInit(&_result); - HRESULT _hr = raw_GetChunk(Length, &_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _variant_t(_result, false); -} - -inline _variant_t Field20::GetOriginalValue ( ) { - VARIANT _result; - VariantInit(&_result); - HRESULT _hr = get_OriginalValue(&_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _variant_t(_result, false); -} - -inline _variant_t Field20::GetUnderlyingValue ( ) { - VARIANT _result; - VariantInit(&_result); - HRESULT _hr = get_UnderlyingValue(&_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _variant_t(_result, false); -} - -inline IUnknownPtr Field20::GetDataFormat ( ) { - IUnknown * _result; - HRESULT _hr = get_DataFormat(&_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return IUnknownPtr(_result, false); -} - -inline void Field20::PutRefDataFormat ( IUnknown * ppiDF ) { - HRESULT _hr = putref_DataFormat(ppiDF); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); -} - -inline void Field20::PutPrecision ( unsigned char pbPrecision ) { - HRESULT _hr = put_Precision(pbPrecision); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); -} - -inline void Field20::PutNumericScale ( unsigned char pbNumericScale ) { - HRESULT _hr = put_NumericScale(pbNumericScale); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); -} - -inline void Field20::PutType ( enum DataTypeEnum pDataType ) { - HRESULT _hr = put_Type(pDataType); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); -} - -inline void Field20::PutDefinedSize ( long pl ) { - HRESULT _hr = put_DefinedSize(pl); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); -} - -inline void Field20::PutAttributes ( long pl ) { - HRESULT _hr = put_Attributes(pl); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); -} - -// -// interface Field wrapper method implementations -// - -inline long Field::GetStatus ( ) { - long _result; - HRESULT _hr = get_Status(&_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _result; -} - -// -// interface _Parameter wrapper method implementations -// - -inline _bstr_t _Parameter::GetName ( ) { - BSTR _result; - HRESULT _hr = get_Name(&_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _bstr_t(_result, false); -} - -inline void _Parameter::PutName ( _bstr_t pbstr ) { - HRESULT _hr = put_Name(pbstr); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); -} - -inline _variant_t _Parameter::GetValue ( ) { - VARIANT _result; - VariantInit(&_result); - HRESULT _hr = get_Value(&_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _variant_t(_result, false); -} - -inline void _Parameter::PutValue ( const _variant_t & pvar ) { - HRESULT _hr = put_Value(pvar); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); -} - -inline enum DataTypeEnum _Parameter::GetType ( ) { - enum DataTypeEnum _result; - HRESULT _hr = get_Type(&_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _result; -} - -inline void _Parameter::PutType ( enum DataTypeEnum psDataType ) { - HRESULT _hr = put_Type(psDataType); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); -} - -inline void _Parameter::PutDirection ( enum ParameterDirectionEnum plParmDirection ) { - HRESULT _hr = put_Direction(plParmDirection); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); -} - -inline enum ParameterDirectionEnum _Parameter::GetDirection ( ) { - enum ParameterDirectionEnum _result; - HRESULT _hr = get_Direction(&_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _result; -} - -inline void _Parameter::PutPrecision ( unsigned char pbPrecision ) { - HRESULT _hr = put_Precision(pbPrecision); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); -} - -inline unsigned char _Parameter::GetPrecision ( ) { - unsigned char _result; - HRESULT _hr = get_Precision(&_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _result; -} - -inline void _Parameter::PutNumericScale ( unsigned char pbScale ) { - HRESULT _hr = put_NumericScale(pbScale); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); -} - -inline unsigned char _Parameter::GetNumericScale ( ) { - unsigned char _result; - HRESULT _hr = get_NumericScale(&_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _result; -} - -inline void _Parameter::PutSize ( long pl ) { - HRESULT _hr = put_Size(pl); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); -} - -inline long _Parameter::GetSize ( ) { - long _result; - HRESULT _hr = get_Size(&_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _result; -} - -inline HRESULT _Parameter::AppendChunk ( const _variant_t & Val ) { - HRESULT _hr = raw_AppendChunk(Val); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _hr; -} - -inline long _Parameter::GetAttributes ( ) { - long _result; - HRESULT _hr = get_Attributes(&_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _result; -} - -inline void _Parameter::PutAttributes ( long plParmAttribs ) { - HRESULT _hr = put_Attributes(plParmAttribs); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); -} - -// -// interface Parameters wrapper method implementations -// - -inline _ParameterPtr Parameters::GetItem ( const _variant_t & Index ) { - struct _Parameter * _result; - HRESULT _hr = get_Item(Index, &_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _ParameterPtr(_result, false); -} - -// -// interface _Command wrapper method implementations -// - -inline long _Command::GetState ( ) { - long _result; - HRESULT _hr = get_State(&_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _result; -} - -inline HRESULT _Command::Cancel ( ) { - HRESULT _hr = raw_Cancel(); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _hr; -} - -// -// interface ConnectionEventsVt wrapper method implementations -// - -inline HRESULT ConnectionEventsVt::InfoMessage ( struct Error * pError, enum EventStatusEnum * adStatus, struct _Connection * pConnection ) { - HRESULT _hr = raw_InfoMessage(pError, adStatus, pConnection); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _hr; -} - -inline HRESULT ConnectionEventsVt::BeginTransComplete ( long TransactionLevel, struct Error * pError, enum EventStatusEnum * adStatus, struct _Connection * pConnection ) { - HRESULT _hr = raw_BeginTransComplete(TransactionLevel, pError, adStatus, pConnection); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _hr; -} - -inline HRESULT ConnectionEventsVt::CommitTransComplete ( struct Error * pError, enum EventStatusEnum * adStatus, struct _Connection * pConnection ) { - HRESULT _hr = raw_CommitTransComplete(pError, adStatus, pConnection); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _hr; -} - -inline HRESULT ConnectionEventsVt::RollbackTransComplete ( struct Error * pError, enum EventStatusEnum * adStatus, struct _Connection * pConnection ) { - HRESULT _hr = raw_RollbackTransComplete(pError, adStatus, pConnection); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _hr; -} - -inline HRESULT ConnectionEventsVt::WillExecute ( BSTR * Source, enum CursorTypeEnum * CursorType, enum LockTypeEnum * LockType, long * Options, enum EventStatusEnum * adStatus, struct _Command * pCommand, struct _Recordset * pRecordset, struct _Connection * pConnection ) { - HRESULT _hr = raw_WillExecute(Source, CursorType, LockType, Options, adStatus, pCommand, pRecordset, pConnection); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _hr; -} - -inline HRESULT ConnectionEventsVt::ExecuteComplete ( long RecordsAffected, struct Error * pError, enum EventStatusEnum * adStatus, struct _Command * pCommand, struct _Recordset * pRecordset, struct _Connection * pConnection ) { - HRESULT _hr = raw_ExecuteComplete(RecordsAffected, pError, adStatus, pCommand, pRecordset, pConnection); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _hr; -} - -inline HRESULT ConnectionEventsVt::WillConnect ( BSTR * ConnectionString, BSTR * UserID, BSTR * Password, long * Options, enum EventStatusEnum * adStatus, struct _Connection * pConnection ) { - HRESULT _hr = raw_WillConnect(ConnectionString, UserID, Password, Options, adStatus, pConnection); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _hr; -} - -inline HRESULT ConnectionEventsVt::ConnectComplete ( struct Error * pError, enum EventStatusEnum * adStatus, struct _Connection * pConnection ) { - HRESULT _hr = raw_ConnectComplete(pError, adStatus, pConnection); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _hr; -} - -inline HRESULT ConnectionEventsVt::Disconnect ( enum EventStatusEnum * adStatus, struct _Connection * pConnection ) { - HRESULT _hr = raw_Disconnect(adStatus, pConnection); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _hr; -} - -// -// interface RecordsetEventsVt wrapper method implementations -// - -inline HRESULT RecordsetEventsVt::WillChangeField ( long cFields, const _variant_t & Fields, enum EventStatusEnum * adStatus, struct _Recordset * pRecordset ) { - HRESULT _hr = raw_WillChangeField(cFields, Fields, adStatus, pRecordset); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _hr; -} - -inline HRESULT RecordsetEventsVt::FieldChangeComplete ( long cFields, const _variant_t & Fields, struct Error * pError, enum EventStatusEnum * adStatus, struct _Recordset * pRecordset ) { - HRESULT _hr = raw_FieldChangeComplete(cFields, Fields, pError, adStatus, pRecordset); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _hr; -} - -inline HRESULT RecordsetEventsVt::WillChangeRecord ( enum EventReasonEnum adReason, long cRecords, enum EventStatusEnum * adStatus, struct _Recordset * pRecordset ) { - HRESULT _hr = raw_WillChangeRecord(adReason, cRecords, adStatus, pRecordset); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _hr; -} - -inline HRESULT RecordsetEventsVt::RecordChangeComplete ( enum EventReasonEnum adReason, long cRecords, struct Error * pError, enum EventStatusEnum * adStatus, struct _Recordset * pRecordset ) { - HRESULT _hr = raw_RecordChangeComplete(adReason, cRecords, pError, adStatus, pRecordset); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _hr; -} - -inline HRESULT RecordsetEventsVt::WillChangeRecordset ( enum EventReasonEnum adReason, enum EventStatusEnum * adStatus, struct _Recordset * pRecordset ) { - HRESULT _hr = raw_WillChangeRecordset(adReason, adStatus, pRecordset); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _hr; -} - -inline HRESULT RecordsetEventsVt::RecordsetChangeComplete ( enum EventReasonEnum adReason, struct Error * pError, enum EventStatusEnum * adStatus, struct _Recordset * pRecordset ) { - HRESULT _hr = raw_RecordsetChangeComplete(adReason, pError, adStatus, pRecordset); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _hr; -} - -inline HRESULT RecordsetEventsVt::WillMove ( enum EventReasonEnum adReason, enum EventStatusEnum * adStatus, struct _Recordset * pRecordset ) { - HRESULT _hr = raw_WillMove(adReason, adStatus, pRecordset); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _hr; -} - -inline HRESULT RecordsetEventsVt::MoveComplete ( enum EventReasonEnum adReason, struct Error * pError, enum EventStatusEnum * adStatus, struct _Recordset * pRecordset ) { - HRESULT _hr = raw_MoveComplete(adReason, pError, adStatus, pRecordset); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _hr; -} - -inline HRESULT RecordsetEventsVt::EndOfRecordset ( VARIANT_BOOL * fMoreData, enum EventStatusEnum * adStatus, struct _Recordset * pRecordset ) { - HRESULT _hr = raw_EndOfRecordset(fMoreData, adStatus, pRecordset); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _hr; -} - -inline HRESULT RecordsetEventsVt::FetchProgress ( long Progress, long MaxProgress, enum EventStatusEnum * adStatus, struct _Recordset * pRecordset ) { - HRESULT _hr = raw_FetchProgress(Progress, MaxProgress, adStatus, pRecordset); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _hr; -} - -inline HRESULT RecordsetEventsVt::FetchComplete ( struct Error * pError, enum EventStatusEnum * adStatus, struct _Recordset * pRecordset ) { - HRESULT _hr = raw_FetchComplete(pError, adStatus, pRecordset); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _hr; -} - -// -// dispinterface ConnectionEvents wrapper method implementations -// - -inline HRESULT ConnectionEvents::InfoMessage ( struct Error * pError, enum EventStatusEnum * adStatus, struct _Connection * pConnection ) { - HRESULT _result; - _com_dispatch_method(this, 0x0, DISPATCH_METHOD, VT_ERROR, (void*)&_result, - L"\x0009\x4003\x0009", pError, adStatus, pConnection); - return _result; -} - -inline HRESULT ConnectionEvents::BeginTransComplete ( long TransactionLevel, struct Error * pError, enum EventStatusEnum * adStatus, struct _Connection * pConnection ) { - HRESULT _result; - _com_dispatch_method(this, 0x1, DISPATCH_METHOD, VT_ERROR, (void*)&_result, - L"\x0003\x0009\x4003\x0009", TransactionLevel, pError, adStatus, pConnection); - return _result; -} - -inline HRESULT ConnectionEvents::CommitTransComplete ( struct Error * pError, enum EventStatusEnum * adStatus, struct _Connection * pConnection ) { - HRESULT _result; - _com_dispatch_method(this, 0x3, DISPATCH_METHOD, VT_ERROR, (void*)&_result, - L"\x0009\x4003\x0009", pError, adStatus, pConnection); - return _result; -} - -inline HRESULT ConnectionEvents::RollbackTransComplete ( struct Error * pError, enum EventStatusEnum * adStatus, struct _Connection * pConnection ) { - HRESULT _result; - _com_dispatch_method(this, 0x2, DISPATCH_METHOD, VT_ERROR, (void*)&_result, - L"\x0009\x4003\x0009", pError, adStatus, pConnection); - return _result; -} - -inline HRESULT ConnectionEvents::WillExecute ( BSTR * Source, enum CursorTypeEnum * CursorType, enum LockTypeEnum * LockType, long * Options, enum EventStatusEnum * adStatus, struct _Command * pCommand, struct _Recordset * pRecordset, struct _Connection * pConnection ) { - HRESULT _result; - _com_dispatch_method(this, 0x4, DISPATCH_METHOD, VT_ERROR, (void*)&_result, - L"\x4008\x4003\x4003\x4003\x4003\x0009\x0009\x0009", Source, CursorType, LockType, Options, adStatus, pCommand, pRecordset, pConnection); - return _result; -} - -inline HRESULT ConnectionEvents::ExecuteComplete ( long RecordsAffected, struct Error * pError, enum EventStatusEnum * adStatus, struct _Command * pCommand, struct _Recordset * pRecordset, struct _Connection * pConnection ) { - HRESULT _result; - _com_dispatch_method(this, 0x5, DISPATCH_METHOD, VT_ERROR, (void*)&_result, - L"\x0003\x0009\x4003\x0009\x0009\x0009", RecordsAffected, pError, adStatus, pCommand, pRecordset, pConnection); - return _result; -} - -inline HRESULT ConnectionEvents::WillConnect ( BSTR * ConnectionString, BSTR * UserID, BSTR * Password, long * Options, enum EventStatusEnum * adStatus, struct _Connection * pConnection ) { - HRESULT _result; - _com_dispatch_method(this, 0x6, DISPATCH_METHOD, VT_ERROR, (void*)&_result, - L"\x4008\x4008\x4008\x4003\x4003\x0009", ConnectionString, UserID, Password, Options, adStatus, pConnection); - return _result; -} - -inline HRESULT ConnectionEvents::ConnectComplete ( struct Error * pError, enum EventStatusEnum * adStatus, struct _Connection * pConnection ) { - HRESULT _result; - _com_dispatch_method(this, 0x7, DISPATCH_METHOD, VT_ERROR, (void*)&_result, - L"\x0009\x4003\x0009", pError, adStatus, pConnection); - return _result; -} - -inline HRESULT ConnectionEvents::Disconnect ( enum EventStatusEnum * adStatus, struct _Connection * pConnection ) { - HRESULT _result; - _com_dispatch_method(this, 0x8, DISPATCH_METHOD, VT_ERROR, (void*)&_result, - L"\x4003\x0009", adStatus, pConnection); - return _result; -} - -// -// dispinterface RecordsetEvents wrapper method implementations -// - -inline HRESULT RecordsetEvents::WillChangeField ( long cFields, const _variant_t & Fields, enum EventStatusEnum * adStatus, struct _Recordset * pRecordset ) { - HRESULT _result; - _com_dispatch_method(this, 0x9, DISPATCH_METHOD, VT_ERROR, (void*)&_result, - L"\x0003\x000c\x4003\x0009", cFields, &Fields, adStatus, pRecordset); - return _result; -} - -inline HRESULT RecordsetEvents::FieldChangeComplete ( long cFields, const _variant_t & Fields, struct Error * pError, enum EventStatusEnum * adStatus, struct _Recordset * pRecordset ) { - HRESULT _result; - _com_dispatch_method(this, 0xa, DISPATCH_METHOD, VT_ERROR, (void*)&_result, - L"\x0003\x000c\x0009\x4003\x0009", cFields, &Fields, pError, adStatus, pRecordset); - return _result; -} - -inline HRESULT RecordsetEvents::WillChangeRecord ( enum EventReasonEnum adReason, long cRecords, enum EventStatusEnum * adStatus, struct _Recordset * pRecordset ) { - HRESULT _result; - _com_dispatch_method(this, 0xb, DISPATCH_METHOD, VT_ERROR, (void*)&_result, - L"\x0003\x0003\x4003\x0009", adReason, cRecords, adStatus, pRecordset); - return _result; -} - -inline HRESULT RecordsetEvents::RecordChangeComplete ( enum EventReasonEnum adReason, long cRecords, struct Error * pError, enum EventStatusEnum * adStatus, struct _Recordset * pRecordset ) { - HRESULT _result; - _com_dispatch_method(this, 0xc, DISPATCH_METHOD, VT_ERROR, (void*)&_result, - L"\x0003\x0003\x0009\x4003\x0009", adReason, cRecords, pError, adStatus, pRecordset); - return _result; -} - -inline HRESULT RecordsetEvents::WillChangeRecordset ( enum EventReasonEnum adReason, enum EventStatusEnum * adStatus, struct _Recordset * pRecordset ) { - HRESULT _result; - _com_dispatch_method(this, 0xd, DISPATCH_METHOD, VT_ERROR, (void*)&_result, - L"\x0003\x4003\x0009", adReason, adStatus, pRecordset); - return _result; -} - -inline HRESULT RecordsetEvents::RecordsetChangeComplete ( enum EventReasonEnum adReason, struct Error * pError, enum EventStatusEnum * adStatus, struct _Recordset * pRecordset ) { - HRESULT _result; - _com_dispatch_method(this, 0xe, DISPATCH_METHOD, VT_ERROR, (void*)&_result, - L"\x0003\x0009\x4003\x0009", adReason, pError, adStatus, pRecordset); - return _result; -} - -inline HRESULT RecordsetEvents::WillMove ( enum EventReasonEnum adReason, enum EventStatusEnum * adStatus, struct _Recordset * pRecordset ) { - HRESULT _result; - _com_dispatch_method(this, 0xf, DISPATCH_METHOD, VT_ERROR, (void*)&_result, - L"\x0003\x4003\x0009", adReason, adStatus, pRecordset); - return _result; -} - -inline HRESULT RecordsetEvents::MoveComplete ( enum EventReasonEnum adReason, struct Error * pError, enum EventStatusEnum * adStatus, struct _Recordset * pRecordset ) { - HRESULT _result; - _com_dispatch_method(this, 0x10, DISPATCH_METHOD, VT_ERROR, (void*)&_result, - L"\x0003\x0009\x4003\x0009", adReason, pError, adStatus, pRecordset); - return _result; -} - -inline HRESULT RecordsetEvents::EndOfRecordset ( VARIANT_BOOL * fMoreData, enum EventStatusEnum * adStatus, struct _Recordset * pRecordset ) { - HRESULT _result; - _com_dispatch_method(this, 0x11, DISPATCH_METHOD, VT_ERROR, (void*)&_result, - L"\x400b\x4003\x0009", fMoreData, adStatus, pRecordset); - return _result; -} - -inline HRESULT RecordsetEvents::FetchProgress ( long Progress, long MaxProgress, enum EventStatusEnum * adStatus, struct _Recordset * pRecordset ) { - HRESULT _result; - _com_dispatch_method(this, 0x12, DISPATCH_METHOD, VT_ERROR, (void*)&_result, - L"\x0003\x0003\x4003\x0009", Progress, MaxProgress, adStatus, pRecordset); - return _result; -} - -inline HRESULT RecordsetEvents::FetchComplete ( struct Error * pError, enum EventStatusEnum * adStatus, struct _Recordset * pRecordset ) { - HRESULT _result; - _com_dispatch_method(this, 0x13, DISPATCH_METHOD, VT_ERROR, (void*)&_result, - L"\x0009\x4003\x0009", pError, adStatus, pRecordset); - return _result; -} - -// -// interface ADOConnectionConstruction15 wrapper method implementations -// - -inline IUnknownPtr ADOConnectionConstruction15::GetDSO ( ) { - IUnknown * _result; - HRESULT _hr = get_DSO(&_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return IUnknownPtr(_result, false); -} - -inline IUnknownPtr ADOConnectionConstruction15::GetSession ( ) { - IUnknown * _result; - HRESULT _hr = get_Session(&_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return IUnknownPtr(_result, false); -} - -inline HRESULT ADOConnectionConstruction15::WrapDSOandSession ( IUnknown * pDSO, IUnknown * pSession ) { - HRESULT _hr = raw_WrapDSOandSession(pDSO, pSession); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _hr; -} - -// -// interface _Record wrapper method implementations -// - -inline _variant_t _Record::GetActiveConnection ( ) { - VARIANT _result; - VariantInit(&_result); - HRESULT _hr = get_ActiveConnection(&_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _variant_t(_result, false); -} - -inline void _Record::PutActiveConnection ( _bstr_t pvar ) { - HRESULT _hr = put_ActiveConnection(pvar); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); -} - -inline void _Record::PutRefActiveConnection ( struct _Connection * pvar ) { - HRESULT _hr = putref_ActiveConnection(pvar); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); -} - -inline enum ObjectStateEnum _Record::GetState ( ) { - enum ObjectStateEnum _result; - HRESULT _hr = get_State(&_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _result; -} - -inline _variant_t _Record::GetSource ( ) { - VARIANT _result; - VariantInit(&_result); - HRESULT _hr = get_Source(&_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _variant_t(_result, false); -} - -inline void _Record::PutSource ( _bstr_t pvar ) { - HRESULT _hr = put_Source(pvar); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); -} - -inline void _Record::PutRefSource ( IDispatch * pvar ) { - HRESULT _hr = putref_Source(pvar); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); -} - -inline enum ConnectModeEnum _Record::GetMode ( ) { - enum ConnectModeEnum _result; - HRESULT _hr = get_Mode(&_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _result; -} - -inline void _Record::PutMode ( enum ConnectModeEnum pMode ) { - HRESULT _hr = put_Mode(pMode); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); -} - -inline _bstr_t _Record::GetParentURL ( ) { - BSTR _result; - HRESULT _hr = get_ParentURL(&_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _bstr_t(_result, false); -} - -inline _bstr_t _Record::MoveRecord ( _bstr_t Source, _bstr_t Destination, _bstr_t UserName, _bstr_t Password, enum MoveRecordOptionsEnum Options, VARIANT_BOOL Async ) { - BSTR _result; - HRESULT _hr = raw_MoveRecord(Source, Destination, UserName, Password, Options, Async, &_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _bstr_t(_result, false); -} - -inline _bstr_t _Record::CopyRecord ( _bstr_t Source, _bstr_t Destination, _bstr_t UserName, _bstr_t Password, enum CopyRecordOptionsEnum Options, VARIANT_BOOL Async ) { - BSTR _result; - HRESULT _hr = raw_CopyRecord(Source, Destination, UserName, Password, Options, Async, &_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _bstr_t(_result, false); -} - -inline HRESULT _Record::DeleteRecord ( _bstr_t Source, VARIANT_BOOL Async ) { - HRESULT _hr = raw_DeleteRecord(Source, Async); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _hr; -} - -inline HRESULT _Record::Open ( const _variant_t & Source, const _variant_t & ActiveConnection, enum ConnectModeEnum Mode, enum RecordCreateOptionsEnum CreateOptions, enum RecordOpenOptionsEnum Options, _bstr_t UserName, _bstr_t Password ) { - HRESULT _hr = raw_Open(Source, ActiveConnection, Mode, CreateOptions, Options, UserName, Password); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _hr; -} - -inline HRESULT _Record::Close ( ) { - HRESULT _hr = raw_Close(); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _hr; -} - -inline FieldsPtr _Record::GetFields ( ) { - struct Fields * _result; - HRESULT _hr = get_Fields(&_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return FieldsPtr(_result, false); -} - -inline enum RecordTypeEnum _Record::GetRecordType ( ) { - enum RecordTypeEnum _result; - HRESULT _hr = get_RecordType(&_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _result; -} - -inline _RecordsetPtr _Record::GetChildren ( ) { - struct _Recordset * _result; - HRESULT _hr = raw_GetChildren(&_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _RecordsetPtr(_result, false); -} - -inline HRESULT _Record::Cancel ( ) { - HRESULT _hr = raw_Cancel(); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _hr; -} - -// -// interface IRecFields wrapper method implementations -// - -inline HRESULT IRecFields::ADOCheck ( ) { - HRESULT _hr = raw_ADOCheck(); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _hr; -} - -// -// interface _Stream wrapper method implementations -// - -inline long _Stream::GetSize ( ) { - long _result; - HRESULT _hr = get_Size(&_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _result; -} - -inline VARIANT_BOOL _Stream::GetEOS ( ) { - VARIANT_BOOL _result; - HRESULT _hr = get_EOS(&_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _result; -} - -inline long _Stream::GetPosition ( ) { - long _result; - HRESULT _hr = get_Position(&_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _result; -} - -inline void _Stream::PutPosition ( long pPos ) { - HRESULT _hr = put_Position(pPos); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); -} - -inline enum StreamTypeEnum _Stream::GetType ( ) { - enum StreamTypeEnum _result; - HRESULT _hr = get_Type(&_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _result; -} - -inline void _Stream::PutType ( enum StreamTypeEnum ptype ) { - HRESULT _hr = put_Type(ptype); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); -} - -inline enum LineSeparatorEnum _Stream::GetLineSeparator ( ) { - enum LineSeparatorEnum _result; - HRESULT _hr = get_LineSeparator(&_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _result; -} - -inline void _Stream::PutLineSeparator ( enum LineSeparatorEnum pLS ) { - HRESULT _hr = put_LineSeparator(pLS); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); -} - -inline enum ObjectStateEnum _Stream::GetState ( ) { - enum ObjectStateEnum _result; - HRESULT _hr = get_State(&_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _result; -} - -inline enum ConnectModeEnum _Stream::GetMode ( ) { - enum ConnectModeEnum _result; - HRESULT _hr = get_Mode(&_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _result; -} - -inline void _Stream::PutMode ( enum ConnectModeEnum pMode ) { - HRESULT _hr = put_Mode(pMode); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); -} - -inline _bstr_t _Stream::GetCharset ( ) { - BSTR _result; - HRESULT _hr = get_Charset(&_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _bstr_t(_result, false); -} - -inline void _Stream::PutCharset ( _bstr_t pbstrCharset ) { - HRESULT _hr = put_Charset(pbstrCharset); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); -} - -inline _variant_t _Stream::Read ( long NumBytes ) { - VARIANT _result; - VariantInit(&_result); - HRESULT _hr = raw_Read(NumBytes, &_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _variant_t(_result, false); -} - -inline HRESULT _Stream::Open ( const _variant_t & Source, enum ConnectModeEnum Mode, enum StreamOpenOptionsEnum Options, _bstr_t UserName, _bstr_t Password ) { - HRESULT _hr = raw_Open(Source, Mode, Options, UserName, Password); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _hr; -} - -inline HRESULT _Stream::Close ( ) { - HRESULT _hr = raw_Close(); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _hr; -} - -inline HRESULT _Stream::SkipLine ( ) { - HRESULT _hr = raw_SkipLine(); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _hr; -} - -inline HRESULT _Stream::Write ( const _variant_t & Buffer ) { - HRESULT _hr = raw_Write(Buffer); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _hr; -} - -inline HRESULT _Stream::SetEOS ( ) { - HRESULT _hr = raw_SetEOS(); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _hr; -} - -inline HRESULT _Stream::CopyTo ( struct _Stream * DestStream, long CharNumber ) { - HRESULT _hr = raw_CopyTo(DestStream, CharNumber); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _hr; -} - -inline HRESULT _Stream::Flush ( ) { - HRESULT _hr = raw_Flush(); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _hr; -} - -inline HRESULT _Stream::SaveToFile ( _bstr_t FileName, enum SaveOptionsEnum Options ) { - HRESULT _hr = raw_SaveToFile(FileName, Options); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _hr; -} - -inline HRESULT _Stream::LoadFromFile ( _bstr_t FileName ) { - HRESULT _hr = raw_LoadFromFile(FileName); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _hr; -} - -inline _bstr_t _Stream::ReadText ( long NumChars ) { - BSTR _result; - HRESULT _hr = raw_ReadText(NumChars, &_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _bstr_t(_result, false); -} - -inline HRESULT _Stream::WriteText ( _bstr_t Data, enum StreamWriteEnum Options ) { - HRESULT _hr = raw_WriteText(Data, Options); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _hr; -} - -inline HRESULT _Stream::Cancel ( ) { - HRESULT _hr = raw_Cancel(); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _hr; -} - -// -// interface ADORecordConstruction wrapper method implementations -// - -inline IUnknownPtr ADORecordConstruction::GetRow ( ) { - IUnknown * _result; - HRESULT _hr = get_Row(&_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return IUnknownPtr(_result, false); -} - -inline void ADORecordConstruction::PutRow ( IUnknown * ppRow ) { - HRESULT _hr = put_Row(ppRow); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); -} - -inline void ADORecordConstruction::PutParentRow ( IUnknown * _arg1 ) { - HRESULT _hr = put_ParentRow(_arg1); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); -} - -// -// interface ADOStreamConstruction wrapper method implementations -// - -inline IUnknownPtr ADOStreamConstruction::GetStream ( ) { - IUnknown * _result; - HRESULT _hr = get_Stream(&_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return IUnknownPtr(_result, false); -} - -inline void ADOStreamConstruction::PutStream ( IUnknown * ppStm ) { - HRESULT _hr = put_Stream(ppStm); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); -} - -// -// interface ADOCommandConstruction wrapper method implementations -// - -inline IUnknownPtr ADOCommandConstruction::GetOLEDBCommand ( ) { - IUnknown * _result; - HRESULT _hr = get_OLEDBCommand(&_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return IUnknownPtr(_result, false); -} - -inline void ADOCommandConstruction::PutOLEDBCommand ( IUnknown * ppOLEDBCommand ) { - HRESULT _hr = put_OLEDBCommand(ppOLEDBCommand); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); -} - -// -// interface ADORecordsetConstruction wrapper method implementations -// - -inline IUnknownPtr ADORecordsetConstruction::GetRowset ( ) { - IUnknown * _result; - HRESULT _hr = get_Rowset(&_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return IUnknownPtr(_result, false); -} - -inline void ADORecordsetConstruction::PutRowset ( IUnknown * ppRowset ) { - HRESULT _hr = put_Rowset(ppRowset); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); -} - -inline long ADORecordsetConstruction::GetChapter ( ) { - long _result; - HRESULT _hr = get_Chapter(&_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _result; -} - -inline void ADORecordsetConstruction::PutChapter ( long plChapter ) { - HRESULT _hr = put_Chapter(plChapter); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); -} - -inline IUnknownPtr ADORecordsetConstruction::GetRowPosition ( ) { - IUnknown * _result; - HRESULT _hr = get_RowPosition(&_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return IUnknownPtr(_result, false); -} - -inline void ADORecordsetConstruction::PutRowPosition ( IUnknown * ppRowPos ) { - HRESULT _hr = put_RowPosition(ppRowPos); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); -} - -// -// interface Field15 wrapper method implementations -// - -inline long Field15::GetActualSize ( ) { - long _result; - HRESULT _hr = get_ActualSize(&_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _result; -} - -inline long Field15::GetAttributes ( ) { - long _result; - HRESULT _hr = get_Attributes(&_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _result; -} - -inline long Field15::GetDefinedSize ( ) { - long _result; - HRESULT _hr = get_DefinedSize(&_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _result; -} - -inline _bstr_t Field15::GetName ( ) { - BSTR _result; - HRESULT _hr = get_Name(&_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _bstr_t(_result, false); -} - -inline enum DataTypeEnum Field15::GetType ( ) { - enum DataTypeEnum _result; - HRESULT _hr = get_Type(&_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _result; -} - -inline _variant_t Field15::GetValue ( ) { - VARIANT _result; - VariantInit(&_result); - HRESULT _hr = get_Value(&_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _variant_t(_result, false); -} - -inline void Field15::PutValue ( const _variant_t & pvar ) { - HRESULT _hr = put_Value(pvar); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); -} - -inline unsigned char Field15::GetPrecision ( ) { - unsigned char _result; - HRESULT _hr = get_Precision(&_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _result; -} - -inline unsigned char Field15::GetNumericScale ( ) { - unsigned char _result; - HRESULT _hr = get_NumericScale(&_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _result; -} - -inline HRESULT Field15::AppendChunk ( const _variant_t & Data ) { - HRESULT _hr = raw_AppendChunk(Data); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _hr; -} - -inline _variant_t Field15::GetChunk ( long Length ) { - VARIANT _result; - VariantInit(&_result); - HRESULT _hr = raw_GetChunk(Length, &_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _variant_t(_result, false); -} - -inline _variant_t Field15::GetOriginalValue ( ) { - VARIANT _result; - VariantInit(&_result); - HRESULT _hr = get_OriginalValue(&_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _variant_t(_result, false); -} - -inline _variant_t Field15::GetUnderlyingValue ( ) { - VARIANT _result; - VariantInit(&_result); - HRESULT _hr = get_UnderlyingValue(&_result); - if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); - return _variant_t(_result, false); -} diff --git a/st2gpx/src/nannol.c b/st2gpx/src/nannol.c deleted file mode 100644 index 24573eee2..000000000 --- a/st2gpx/src/nannol.c +++ /dev/null @@ -1,238 +0,0 @@ -/* - nannol.c - - Extract data from MS Streets & Trips .est, Autoroute .axe - and Mapoint .ptm files in GPX format. - - Copyright (C) 2003 James Sherring, james_sherring@yahoo.com - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111 USA - - - This app depends on istorage & istorage-make from Pabs (pabs3@zip.to) - and James Clark's Expat xml parser from http://www.libexpat.org/. - -*/ - -#include -#include -#include -#include -#include - -#include "gpx.h" -#include "st2gpx.h" -#include "annotations.h" - -#ifdef EXPLORE -#include "explore.h" -#endif - -int nullstrcmp(char* str1, char* str2) -{ - if ( (str1==NULL) && (str2==NULL) ) - return 0; - else if( (str1!=NULL) && (str2!=NULL) ) - return strcmp(str1, str2); - else if(str1==NULL) - return -1; - else - return 1; -} - -struct annot_rec * gpx2annot_line_rec(struct gpxpt** ptlist, int num_pts, int annot, int version) -{ - int i; - float x; - float y; - float z; - double lat; - double lon; - int count_points_offset; - int line_offset; - - struct annot_rec * rec = annot_rec_new(); - - switch (version) - { - case 3: - count_points_offset = 53; - line_offset = 57; - rec->buf = (char*)xmalloc(line_offset+12*num_pts); - // copy the standard annotation header, - // with appropriate values set - memcpy(rec->buf, std_annot_linerec_header_v3, LINE_REC_LEN_V3); - break; - case 4: - count_points_offset = 53 +4; - line_offset = 57 + 4; - rec->buf = (char*)xmalloc(line_offset+12*num_pts); - // copy the standard annotation header, - // with appropriate values set - memcpy(rec->buf, std_annot_linerec_header_v4, LINE_REC_LEN_V4); - break; - default: - // FIXME version is passed as a param, should be handled there - printf("Unrecognised record format type %d, unable to process more annotations.\n", rec->type); - return NULL; - break; - } - - // If the last point is 'the same' as the first point, - // then set this as a closed-line. - // 'the same' means same name and epsilon-close - if( (nullstrcmp(ptlist[0]->name, ptlist[num_pts-1]->name) == 0) - && (fabs(ptlist[0]->lat - ptlist[num_pts-1]->lat) < 0.000001) - && (fabs(ptlist[0]->lon - ptlist[num_pts-1]->lon) < 0.000001) ) - { - // set the closed-line flag - *(unsigned char*)(rec->buf+line_offset-9) = 1; - - // So that the last point is only implicit - num_pts--; - - printf("Last point in a track or route is same as the first point, so removing last point and setting this as a closed line.\n"); - } - - // set the annotation (record) number - memcpy(rec->buf+4, &annot, 4); - // set the number of points in the line - memcpy(rec->buf+count_points_offset, &num_pts, 4); - - for (i=0; ilat; - lon = ptlist[i]->lon; - // FIXME how do I specify calc in double but return float? - x = (float)(cos(lon*M_PI/180)*cos(lat*M_PI/180)); - y = (float)(sin(lon*M_PI/180)*cos(lat*M_PI/180)); - z = (float)sin(lat*M_PI/180); - - // We can do the height calculations also, - // and s&t will use this in some calculations, including distance, - // but there is no way to visualise or edit height in s&t. - // The example below is for cylindrical height, not radial height. - -/* if (readheight) { - // 6378137 is earths equatorial radius in meters, 20km less at the poles - fac=1+(height/6378137); - x *= fac; - y *= fac; - z *= fac; -*/ - memcpy(rec->buf + line_offset + 12*i, &x, 4); - memcpy(rec->buf + line_offset + 12*i + 4, &y, 4); - memcpy(rec->buf + line_offset + 12*i + 8, &z, 4); - } - - rec->length = line_offset + 12*num_pts; - rec->annot_num = annot; - rec->line_points = num_pts; - rec->line_offset = line_offset; - rec->type = ANNOT_TYPE_LINE; - return rec; -} - -struct annotations * merge_gpx_annot(struct annotations * annots, struct gpx_data* all_gpx) -{ - int i; - int this_annot_num=0; - int tot_num_annots=0; - struct gpxrte * this_rte=NULL; - struct gpxtrk * this_trk=NULL; - - if ( (all_gpx==NULL) || (all_gpx->rte_list_count + all_gpx->trk_list_count==0) ) - return annots; - - if (annots==NULL) - annots = annotations_new(); - - tot_num_annots = annots->num_annotations + all_gpx->rte_list_count - + all_gpx->trk_list_count; - - //printf("reallocing annots, from %d annotations to %d annotations\n", tot_num_annots); - - annots->annot_list = (struct annot_rec**)xrealloc(annots->annot_list, - tot_num_annots*sizeof(struct annot_rec*)); - - // append the gpx routes as annotation lines - for (i=0; i < (all_gpx->rte_list_count); i++) - { - this_annot_num = annots->num_annotations + i; - this_rte = all_gpx->rte_list[i]; - annots->annot_list[this_annot_num] - = gpx2annot_line_rec(this_rte->rtept_list, - this_rte->rtept_list_count, - (annots->max_annot_num)+i+1, - annots->version); - - } - - this_rte=NULL; - annots->num_annotations += all_gpx->rte_list_count; - annots->max_annot_num += all_gpx->rte_list_count; - - // append the gpx tracks as annotation lines - for (i=0; i < all_gpx->trk_list_count; i++) - { - this_annot_num = annots->num_annotations + i; - this_trk = all_gpx->trk_list[i]; - annots->annot_list[this_annot_num] - = gpx2annot_line_rec(this_trk->trkpt_list, - this_trk->trkpt_list_count, - (annots->max_annot_num)+i+1, - annots->version); - } - annots->num_annotations += all_gpx->trk_list_count; - annots->max_annot_num += all_gpx->trk_list_count; - - memcpy(annots->header_buf+8, &(annots->num_annotations), 4); - - return annots; -} - -void write_annotations(struct annotations * annots, char* annot_out_file_name) -{ // Write annotation file header - int status; - int i; - char eostream[4]={0x00, 0x00, 0x00, 0x00}; - FILE* annot_out_file; - - printf("Writing new annotation stream to %s\n", annot_out_file_name); - - if ((annot_out_file = fopen(annot_out_file_name, "wb")) == NULL) { - fprintf(stderr, "Cannot open %s\n", annot_out_file_name); - fflush(stdout); - debug_pause(); - exit(1); - } - - status = fwrite(annots->header_buf, ANNOT_FILE_HEAD_LEN, 1, annot_out_file); - if (status != 1) - printf("expected to write %d, actually wrote %d\n", ANNOT_FILE_HEAD_LEN, status); - - for(i=0; i< annots->num_annotations; i++) - { - status = fwrite(annots->annot_list[i]->buf, annots->annot_list[i]->length, 1, annot_out_file); - if (status != 1) - printf("expected to write %d, actually wrote %d\n", annots->annot_list[i]->length, status); - } - - status = fwrite(eostream, 4, 1, annot_out_file); - if (status != 1) - printf("expected to write %d, actually wrote %d\n", 4, status); - - fclose(annot_out_file); -} diff --git a/st2gpx/src/ppinutil.c b/st2gpx/src/ppinutil.c deleted file mode 100644 index 1e99cf568..000000000 --- a/st2gpx/src/ppinutil.c +++ /dev/null @@ -1,303 +0,0 @@ -/* - ppinutil.c - - Extract data from MS Streets & Trips .est, Autoroute .axe - and Mapoint .ptm files in GPX format. - - Copyright (C) 2003 James Sherring, james_sherring@yahoo.com - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111 USA - - - This app depends on istorage & istorage-make from Pabs (pabs3@zip.to) - and James Clark's Expat xml parser from http://www.libexpat.org/. - -*/ -#include -#include -#include -#include -#include -#include - -#include "gpx.h" -#include "st2gpx.h" -#include "pushpins.h" -#include "ppinutil.h" - -#ifdef EXPLORE -#include "explore.h" -#endif - -struct pushpin_safelist * pushpin_safelist_new() -{ - int i; - struct pushpin_safelist * nw = (struct pushpin_safelist*)xmalloc(sizeof(struct pushpin_safelist)); - nw->pushpin_list=NULL; - nw->num_pushpins=0; - for(i=0; i<3; i++) - { - nw->UDM_Data_length[i]=0; - nw->UDM_Data[i]=NULL; - } - return nw; -} - -void pushpin_safelist_delete(struct pushpin_safelist * ppl) -{ - int i; - if (ppl==NULL) - return; - - for (i=0; inum_pushpins; i++) - pushpin_delete(ppl->pushpin_list[i]); - - free(ppl->pushpin_list); - - for(i=0; i<3; i++) - free(ppl->UDM_Data[i]); - - free(ppl); -} - -struct pushpin * pushpin_new() -{ - struct pushpin * nw = (struct pushpin*)xmalloc(sizeof(struct pushpin)); - nw->garmin_ident[0]=0; - nw->Grid=0; - nw->Precision=0; - nw->lat=0; - nw->lon=0; - nw->NoteShort=NULL; - nw->UdName=NULL; - strcpy(nw->garmin_ident, " "); - nw->RenderData=0; - nw->RenderData2=0; - nw->url=NULL; - nw->urlname=NULL; - return nw; -} - -void pushpin_delete(struct pushpin * pp) -{ - if(pp==NULL) - return; - free(pp->NoteShort); - free(pp->UdName); - free(pp->url); - free(pp->urlname); - free(pp); -} - -struct point grid2latlon(long grid, long precision) -//struct point ms2latlong(struct ms_point msp) -{ -// Convert the 2 long values in UserData stream to GPS coordinates. - -// Grid and Precision are the high and low words obtained by interleaving the bits -// of latitude and longitude. There is a scale factor, so that grid represents -// latitude and longitude value parts more than ~ 1/182.0444 = 360/2^16, -// and precision represents the rest of the values. - -// So we pull each 2n-th bit out, and shift it n places back to the nth longitudinal bit -// and we pull each 2n-th+1 bit out, and shift it n+1 places to the nth latitudinal bit, - - unsigned long int lat_mask=1; - unsigned long int lon_mask=2; - unsigned long int lat_val = 0; - unsigned long int lon_val = 0; - struct point p; - - int i; - - if (grid==0x3FFFFFFF) - { - printf("Got bad Grid value 0x3FFFFFFF converting pushpin data.\n"); - p.lat=-180; - p.lon=-180; - return p; - } - for(i=0; i<16; i++) - { - lat_val += (lat_mask & grid) >> i; - lon_val += (lon_mask & grid) >> (i+1); - lat_mask <<= 2; - lon_mask <<= 2; - } - - - p.lat = (double) lat_val ;// magic1; - p.lon = (double) lon_val ;// magic1; - - lat_mask=1; - lon_mask=2; - lat_val=0; - lon_val=0; - - for (i=0; i<16; i++) - { - lat_val += (lat_mask & precision) >> i; - lon_val += (lon_mask & precision) >> (i+1); - lat_mask <<= 2; - lon_mask <<= 2; - } - -// p.lat += (double) lat_val / (magic2); -// p.lon += (double) lon_val / (magic2); - p.lat += (double) lat_val / (double) (0x10000); - p.lon += (double) lon_val / (double) (0x10000); - - p.lat *= 360/(double) (0x10000); - p.lon *= 360/(double) (0x10000); - - if (p.lon > 180) p.lon -= 360; - if (p.lat > 180) p.lat -= 360; - - if ( (p.lat > 90) || (p.lat < -90) ) - { - printf("Got bad lat value %f converting pushpin data, setting.\n"); -// p.lat=-180; -// p.lon=-180; - } - - return p; -} - -struct grid_point latlon2grid(double lat, double lon) { - - struct grid_point msp; - unsigned long mask=1; - int i; - double scaled_lat = (lat/360) * (0x10000); - double scaled_lon = (lon/360) * (0x10000); - unsigned long lat_grid_ndx = (unsigned long)floor(scaled_lat); - unsigned long lon_grid_ndx = (unsigned long)floor(scaled_lon); - unsigned long lat_prec_ndx = (unsigned long)floor((scaled_lat - lat_grid_ndx)*(0x10000)); - unsigned long lon_prec_ndx = (unsigned long)floor((scaled_lon - lon_grid_ndx)*(0x10000)); - msp.grid=0; - msp.precision=0; - - for(i=0; i<16; i++) { - msp.grid += ((mask & lat_grid_ndx) << i);; - msp.grid += ((mask & lon_grid_ndx) << (i+1)); - mask <<= 1; - } - - mask=1; - for(i=0; i<16; i++) { - msp.precision += ((mask & lat_prec_ndx) << i); - msp.precision += ((mask & lon_prec_ndx) << (i+1)); - mask <<= 1; - } - return msp; -} - -struct pushpin * ppin_by_UdId(int UdId, struct pushpin_safelist * ppplist) -{ - int i; - - //printf("looking to match UdId %d to a pushpin\n", UdId); - //fflush(stdout); - - if (UdId == 0) - return NULL; - - if (ppplist==NULL) - { - printf("Looking for UdId %#x=%d in an empty pushpin list???\n", UdId, UdId); - return NULL; - } - - for (i=0; i< ppplist->num_pushpins; i++) - { - //printf("Comparing to pushpin %d\n", i); - //fflush(stdout); - if(ppplist->pushpin_list[i] == NULL) - return NULL; - - //printf(" with UdId %ld ", (ppplist->pushpin_list[i])->UdId); - //fflush(stdout); - //printf(" and name %s\n", (ppplist->pushpin_list[i])->UdName); - - if ((ppplist->pushpin_list[i]->UdId) == 0) - return NULL; - - if (ppplist->pushpin_list[i]->UdId == UdId) - return ppplist->pushpin_list[i]; - } - return NULL; -} - -int check_file_empty(char* filename) -// FIXME there must be a better way to do this -{ - int readchar; - int retval=0; - FILE* file = fopen(filename, "rb"); - // also check if the file exists - if (file==NULL) - retval= 1; - else - { - readchar = fgetc(file); - if (readchar == EOF) - retval=1; - else - retval=0; - } - if (file) - fclose(file); - return retval; -} - -struct pushpin_safelist * process_pushpin_file(char* ppin_in_file_name) -{ - int i=0; - struct point p; -// struct ms_point msp; - struct pushpin_safelist * ppplist; - - // dont try and open a empty mdb file - if (check_file_empty(ppin_in_file_name)) - return NULL;; - ppplist=read_pushpins(ppin_in_file_name); - - // set lat & lon for all pushpins - while(ppplist->pushpin_list[i] && (inum_pushpins)) - { -// msp.grid = ppplist->pushpin_list[i]->Grid; -// msp.precision = ppplist->pushpin_list[i]->Precision; -// p = grid2latlon(msp); - p = grid2latlon(ppplist->pushpin_list[i]->Grid, ppplist->pushpin_list[i]->Precision); - - ppplist->pushpin_list[i]->lat = p.lat; - ppplist->pushpin_list[i]->lon = p.lon; - - if (opts.verbose_flag > 3) - printf("Decoded pushpin %d lat %f, lon %f, UdName %s, NoteShort %s\n", - ppplist->pushpin_list[i]->UdId, ppplist->pushpin_list[i]->lat, ppplist->pushpin_list[i]->lon, - ppplist->pushpin_list[i]->UdName, ppplist->pushpin_list[i]->NoteShort); - - i++; - } - - if (opts.verbose_flag>2) - printf("Finished reading pushpins\n"); - fflush(stdout); - - return ppplist; -} - - diff --git a/st2gpx/src/ppinutil.h b/st2gpx/src/ppinutil.h deleted file mode 100644 index f71689f68..000000000 --- a/st2gpx/src/ppinutil.h +++ /dev/null @@ -1,134 +0,0 @@ -/* - ppinutil.h - - Extract data from MS Streets & Trips .est, Autoroute .axe - and Mapoint .ptm files in GPX format. - - Copyright (C) 2003 James Sherring, james_sherring@yahoo.com - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111 USA - - - This app depends on istorage & istorage-make from Pabs (pabs3@zip.to) - and James Clark's Expat xml parser from http://www.libexpat.org/. - -*/ -#ifdef __cplusplus -extern "C" { -#endif - -struct pushpin_safelist -{ - struct pushpin ** pushpin_list; - int num_pushpins; - char * UDM_Data[3]; - long UDM_Data_length[3]; -}; - -struct grid_point { - long grid; - long precision; -}; - -struct point { - double lon; - double lat; -}; - -// max size to be read from ppin memo fields -#define MAX_PPIN_MEMO 1000 - -struct pushpin -{ - long UdId; - int SetId; - long Grid; - long Precision; - int RenderData; - // only in mappoint? - int RenderData2; -// dword RenderData; - // 1 = by hand - // 2 = from file? - // 4 = not matched? - short int MatchId; - long MOBBId; -// long SourceUdId; -// bool IsTerritory; -// - char* UdName; // max 128 -// bool NoNameSearch; -// byte NoteTypeId; - char* NoteShort; // max 255 -// char* NoteLong; // memo -// char* GeocodeShort; // max 255 -// char* GeocodeLong; // memo -// byte GeocodeHierarchy; -// byte GeocodeContext; -// OLE Object EntityArray ???? -// -// shouldn't include these 3 here because they are not part of the native pushpin definition - double lat; - double lon; - char garmin_ident[7]; - char* url; - char* urlname; -} ; - - -// not used yet - -struct pushpinset -{ - int SetId; - char* SetName; // max 128 -/* byte RenderMethod; - byte GeocodeMethod; - byte CreateMethod; - byte GeometryType; - char[128] RenderData; - long UdCount; - long MatchedCount; - long SkippedCount; - long UnmatchedCount; - long CounterUpdateMask; - int ParentSetId; - bool IsRendered; - long Z_Order; - long GeocodeCtxt; - OLE Object ThemeRenderData - date/time LastGeocoded - char* DataSrcDescr; // memo - char[30] CurrencyData; -*/ -}; - -struct pushpin * pushpin_new(); -void pushpin_delete(struct pushpin * pp); -struct pushpin_safelist * pushpin_safelist_new(); -void pushpin_safelist_delete(struct pushpin_safelist * ppl); - -struct pushpin * ppin_by_UdId(int UdId, struct pushpin_safelist * ppplist); -struct pushpin_safelist * process_pushpin_file(char* ppin_in_file_name); - -//struct point ms2latlong(struct ms_point msp); -struct point grid2latlon(long grid, long precision); -struct grid_point latlon2grid(double lat, double lon); - -void explore_udm_data(struct pushpin_safelist * ppl); - -#ifdef __cplusplus -} -#endif diff --git a/st2gpx/src/properties.c b/st2gpx/src/properties.c deleted file mode 100644 index 2bf6077c2..000000000 --- a/st2gpx/src/properties.c +++ /dev/null @@ -1,460 +0,0 @@ -/* - properties.c - - Extract data from MS Streets & Trips .est, Autoroute .axe - and Mapoint .ptm files in GPX format. - - Copyright (C) 2003 James Sherring, james_sherring@yahoo.com - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111 USA - - - This app depends on istorage & istorage-make from Pabs (pabs3@zip.to) - and James Clark's Expat xml parser from http://www.libexpat.org/. - -*/ - -// see http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnolegen/html/msdn_propset.asp -// http://www.dwam.net/docs/oleref/storage_9.htm - - -#include -#include -#include - -#include "st2gpx.h" -#include "properties.h" - -#ifdef EXPLORE -#include "explore.h" -#endif - -#define OLE_PROP_STREAM ".Olhud5yvVwudb10uAaq5ezn4Ac" - -// some types from MS, as published at -// http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnolegen/html/msdn_propset.asp - -typedef struct PROPERTYSETHEADER -{ - // Header - WORD wByteOrder; // Always 0xFFFE - WORD wFormat; // Always 0 - WORD dwOSVer; // System version - // I needed to add this to get code to work with 1-byte structs alignment; - // It is normally effectively added by VC++ default compiler setting - WORD alignment_fill; - CLSID clsid; // Application CLSID - DWORD dwReserved; // Should be 1 -} PROPERTYSETHEADER; - -typedef struct FORMATIDOFFSET -{ - FMTID fmtid ; // semantic name of a section - DWORD dwOffset ; // offset from start of whole property set - // stream to the section -} FORMATIDOFFSET; - -typedef struct PROPERTYIDOFFSET -{ - DWORD propid; // name of a property - DWORD dwOffset; // offset from the start of the section to that - // property type/value pair -} PROPERTYIDOFFSET; - -typedef struct tagPROPERTYSECTIONHEADER -{ - DWORD cbSection ; // Size of section - DWORD cProperties ; // Count of properties in section - PROPERTYIDOFFSET rgPropIDOffset[]; // Array of property locations -} PROPERTYSECTIONHEADER; - -typedef struct SERIALIZEDPROPERTYVALUE -{ - DWORD dwType; // type tag - BYTE rgb[]; // the actual property value -} SERIALIZEDPROPERTYVALUE; - -/* -typedef struct tagENTRY { - DWORD propid; // Property ID - DWORD cb; // Count of bytes in the string, including the null - // at the end. - char sz[cb]; // Zero-terminated string. Code page as indicated - // by property ID one. - } ENTRY; - -typedef struct tagDICTIONARY { - DWORD cEntries; // Count of entries in the list. - ENTRY rgEntry[cEntries]; - } DICTIONARY; -*/ - -// my defs - -char * fmtid2str(char * str, char * fmtid) -// normal fmtids are a 16B struct, I use a 16B char buf -// fmtid should be 16B long -// str should be 39B long (incl null) -// We need to be careful here to get the byte order correct. -// This seems to match MS's interpretation. -{ - sprintf(str, "{%8.8x-%4.4x-%4.4x-%2.2x%2.2x-%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x}", - *(unsigned long*)(fmtid), - *(unsigned short*)(fmtid+4), - *(unsigned short*)(fmtid+6), - *(unsigned char*)(fmtid+8), - *(unsigned char*)(fmtid+9), - *(unsigned char*)(fmtid+10), - *(unsigned char*)(fmtid+11), - *(unsigned char*)(fmtid+12), - *(unsigned char*)(fmtid+13), - *(unsigned char*)(fmtid+14), - *(unsigned char*)(fmtid+15) ); - str[38]=0; - return str; -} - -struct ole_property_set * ole_property_set_new(int cProps) -{ - struct ole_property_set * props - =(struct ole_property_set*)xmalloc(sizeof(struct ole_property_set)); - props->cProps = cProps; - props->dict=NULL; - props->pPropList = (struct ole_property*)xmalloc(cProps*sizeof(struct ole_property)); - return props; -} - -void ole_property_set_delete(struct ole_property_set * props) -{ - unsigned int i; - - if ( (props==NULL) || (props->pPropList == NULL) ) - return; - - for(i=0; icProps; i++) - { - free(props->pPropList[i].buf); - // FIXME who owns this memory? Cant free it if it is a pointer into another buff - //free(props->pPropList[i]); - } - - if (props->dict != NULL) - { - free(props->dict->ent_propid); - free(props->dict->ent_sz); - free(props->dict); - } - free(props->pPropList); - free(props); -} - - -struct dictionary * read_dictionary(int ents, char* buf, int bufsize) -{ - int ent_read=0; - int bytes_read=0; - int this_ent_cb=0; - struct dictionary * dict = (struct dictionary *)xmalloc(sizeof(struct dictionary)); - dict->cEntries = ents; - dict->ent_propid=(DWORD*)xmalloc(ents*sizeof(DWORD)); - dict->ent_sz=(char**)xmalloc(ents*sizeof(char*)); - - if (opts.verbose_flag > 4) - printf("reading %d entries from dictionary\n", ents); - - while(ent_readbufsize) - { - printf("read past end of buffer while reading properties dictionary\n"); - free(dict->ent_propid); - free(dict->ent_sz); - free(dict); - return NULL; - } - - dict->ent_propid[ent_read]=*(DWORD*)(buf+bytes_read); - bytes_read += 4; - - //dict->ent_cb[ent_read]= - this_ent_cb = *(DWORD*)(buf+bytes_read); -// dict->ent_cb[ent_read]=(DWORD*)(buf+bytes_read); - bytes_read += 4; - - if(this_ent_cb > 128) - { - printf("reading dictionary, read entry for propid %#x with name length %d > max allowed length of 128\n", - dict->ent_propid[ent_read], this_ent_cb); -// free(dict->ent_cb); - free(dict->ent_propid); - free(dict->ent_sz); - free(dict); - return NULL; - } - - // Dont allocate memory for dictionary strings, - dict->ent_sz[ent_read]=buf+bytes_read; - - // MSDN documentation says cb is bytes, but it is wchars. - bytes_read += 2*this_ent_cb; - - ent_read++; - } - return dict; -} - -unsigned int get_dict_entry(struct dictionary* dict, DWORD propid) -// Find a dictionary entry for a given propid. -// This is then used to get the name for a propid, if available. -{ - unsigned int i; - if (dict==NULL) - return -1; - - for(i=0; icEntries; i++) - if (dict->ent_propid[i] == propid) - return i; - - return 1; -} - -struct ole_property * get_propterty(struct ole_property_set * props, DWORD propid) -{ - unsigned int i; - - if (props==NULL) - return NULL; - - for(i=0; i< props->cProps; i++) - if( props->pPropList[i].propid == propid) - return props->pPropList+i; - - return NULL; -} - -void print_ole_properties(struct ole_property_set * props) -{ - unsigned int i; - unsigned int j; - char* name; - int dict_ent; - char fmtidstr[39]; - char clsidstr[39]; - - if(props==NULL) - return; - - fmtid2str(fmtidstr, props->fmtid); - fmtid2str(clsidstr, props->clsid); - printf("Printing OLE Property Set, with format id %s,\n", fmtidstr); - printf("clsid %s, os %#x osver %#x\n", clsidstr, props->OSKind, props->OSVer); - - for (i=0; i< (props->cProps); i++) - { - name = NULL; - dict_ent = get_dict_entry(props->dict, props->pPropList[i].propid); - if (dict_ent != -1) - name = props->dict->ent_sz[dict_ent]; - - wprintf(L"\nproperty %d: has name %s propid %#x, type %#x, and length %d bytes\n", - i, name, props->pPropList[i].propid, - props->pPropList[i].dwType, props->pPropList[i].buflen ); - - switch(props->pPropList[i].propid) - { - case 0: - printf("This is the property-set dictionary, with entries:\n"); - printf("PropId Property Name\n"); - printf("-----------------------\n"); - for (j=0; jdict->cEntries; j++) - wprintf(L"%#x %s\n", props->dict->ent_propid[j], (props->dict->ent_sz[j])); - break; - case 1: - printf("This specifies codepage %d (1200=Unicode, 1252=Ansi).\n", - *(USHORT*)(props->pPropList[i].buf) ); - break; - case 0x80000000: - printf("This specifies locale %d .\n", - *(unsigned short*)(props->pPropList[i].buf) ); - break; - default: - switch(props->pPropList[i].dwType) - { - case VT_BSTR: //=8 - // the prefix bytecount is still there - wprintf(L"This has value '%ls'\n", props->pPropList[i].buf+4); - break; - case VT_UNKNOWN: //=13 - break; - case VT_BOOL: // =11 - if (*(short*)(props->pPropList[i].buf)) - printf("This has value 'True'\n"); - else - printf("This has value 'False'\n"); - break; - case VT_I4: // = 3 - printf("This has value %d\n", *(int *)(props->pPropList[i].buf) ); - break; - case VT_LPWSTR: //=31 - wprintf(L"This has value '%ls'\n", (props->pPropList[i].buf+4)); - break; - case VT_FILETIME: //=31 - printf("This has value '%s'\n", ctime((const time_t *)props->pPropList[i].buf+4)); - break; - default: - printf("I dont understand this type yet\n"); - printbuf(props->pPropList[i].buf, props->pPropList[i].buflen); - break; - } - } - } -} - -struct ole_property_set * read_ole_properties2(char* prop_file_name) -{ - FILE* prop_file=NULL; - PROPERTYSETHEADER * prop_header = (PROPERTYSETHEADER *)xmalloc(sizeof(PROPERTYSETHEADER)); - FORMATIDOFFSET * fmt_id_os = (FORMATIDOFFSET *)xmalloc(sizeof(FORMATIDOFFSET)); - PROPERTYSECTIONHEADER * psect_header = (PROPERTYSECTIONHEADER *)xmalloc(sizeof(PROPERTYSECTIONHEADER)); - char* section_buff=NULL; - struct ole_property_set * property_set; - - unsigned int i=0; - unsigned int j=0; - unsigned int next_start=0; - int status=0; - - if ((prop_file = fopen(prop_file_name, "rb")) == NULL) - { - fprintf(stderr, "Cannot open property file %s\n", prop_file_name); - debug_pause(); - exit(3); - //return NULL; - } - - status=readbytes(prop_file, (char*)prop_header, sizeof(PROPERTYSETHEADER)); - status=readbytes(prop_file, (char*)fmt_id_os, sizeof(FORMATIDOFFSET)); - - if ( (prop_header->wByteOrder != 0xFFFE) || (prop_header->wFormat != 0) - || (prop_header->dwReserved != 1) || (fmt_id_os->dwOffset !=0x30) ) - { - printf("Not a valid properties set header in file %s\n", prop_file_name); - fclose(prop_file); - return NULL; - } - - status=readbytes(prop_file, (char*)psect_header, sizeof(PROPERTYSECTIONHEADER)); - - psect_header = (PROPERTYSECTIONHEADER *)xrealloc(psect_header, psect_header->cbSection); - section_buff = (char*)psect_header; - - status=readbytes(prop_file, (char*)(psect_header->rgPropIDOffset), - psect_header->cbSection - sizeof(PROPERTYSECTIONHEADER)); - - property_set = ole_property_set_new(psect_header->cProperties); - memcpy(property_set->fmtid, &(fmt_id_os->fmtid), 16); - memcpy(property_set->clsid, &(prop_header->clsid), 16); - property_set->OSKind = *((short int*)( &(prop_header->dwOSVer) ) +1); - property_set->OSVer = *((short int*)( &(prop_header->dwOSVer) )); - - - // We cant rely on pointer order matching data order, - // so we need to do a little extra work to find the start of the next data - for (i=0; i< psect_header->cProperties ; i++) - { - next_start=psect_header->cbSection; //ie end of the buffer - for(j=0; jcProperties; j++) - if( ( psect_header->rgPropIDOffset[i].dwOffset < psect_header->rgPropIDOffset[j].dwOffset ) - && ( psect_header->rgPropIDOffset[j].dwOffset < next_start) ) - next_start = psect_header->rgPropIDOffset[j].dwOffset; - - property_set->pPropList[i].buflen - = next_start - - psect_header->rgPropIDOffset[i].dwOffset - -4; - } - - - for (i=0; i< psect_header->cProperties; i++) - { - property_set->pPropList[i].propid = psect_header->rgPropIDOffset[i].propid; - -// property_set->pPropList[i].buf -// = section_buff + psect_header->rgPropIDOffset[i].dwOffset + 4; - - property_set->pPropList[i].buf = (char*)xmalloc(property_set->pPropList[i].buflen); - memcpy(property_set->pPropList[i].buf, - section_buff + psect_header->rgPropIDOffset[i].dwOffset + 4, - property_set->pPropList[i].buflen); - - property_set->pPropList[i].dwType = *((DWORD*)(section_buff + psect_header->rgPropIDOffset[i].dwOffset)); - } - - for (i=0; i< property_set->cProps; i++) - if (property_set->pPropList[i].propid==0) - property_set->dict=read_dictionary(property_set->pPropList[i].dwType, - property_set->pPropList[i].buf, - property_set->pPropList[i].buflen); - - fclose(prop_file); - free(prop_header); - free(psect_header); - free(fmt_id_os); - - return property_set; -} - -struct ole_property_set * read_ole_properties(char* source_file_name, char* properties_file_name) -{ - char * prop_file_name; - struct ole_property_set * strips_property_set=NULL; - struct ole_property_set * summary_property_set=NULL; - - if ( (source_file_name==NULL) && (properties_file_name==NULL) ) - return NULL; - - if (source_file_name!=NULL) - prop_file_name = (char*)xmalloc(strlen(source_file_name)+40); - else - prop_file_name = properties_file_name; - - strcpy(prop_file_name, source_file_name); - strcpy(prop_file_name + strlen(prop_file_name), ".Contents\\"); - strcpy(prop_file_name + strlen(prop_file_name), OLE_PROP_STREAM); - strips_property_set = read_ole_properties2(prop_file_name); - if (opts.verbose_flag>3) - { - printf("printing properties from %s\n",OLE_PROP_STREAM); - print_ole_properties(strips_property_set); - } - - // We dont really need this next property set, - // but it may be interesting for debuging - if ( (source_file_name != NULL) && (opts.verbose_flag>3) ) - { - strcpy(prop_file_name, source_file_name); - strcpy(prop_file_name + strlen(prop_file_name), ".Contents\\.SummaryInformation"); - summary_property_set = read_ole_properties2(prop_file_name); - printf("printing properties from .SummaryInformation\n"); - print_ole_properties(summary_property_set); - } - - debug_pause(); - - free(prop_file_name); - ole_property_set_delete(summary_property_set); - - return strips_property_set; -} diff --git a/st2gpx/src/properties.h b/st2gpx/src/properties.h deleted file mode 100644 index ec08cc13d..000000000 --- a/st2gpx/src/properties.h +++ /dev/null @@ -1,73 +0,0 @@ -/* - properties.h - - Extract data from MS Streets & Trips .est, Autoroute .axe - and Mapoint .ptm files in GPX format. - - Copyright (C) 2003 James Sherring, james_sherring@yahoo.com - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111 USA - - - This app depends on istorage & istorage-make from Pabs (pabs3@zip.to) - and James Clark's Expat xml parser from http://www.libexpat.org/. - -*/ -#ifdef __cplusplus -extern "C" { -#endif - - -typedef unsigned long DWORD; - -struct dictionary -{ - DWORD cEntries; // Count of entries in the list. - // array of propids - DWORD * ent_propid; // Property ID - // This next is an array of pointers into properties value, - // with the string length preceeding (ie X->ent_cb == X->ent_sz -4) - char ** ent_sz; // Zero-terminated string. Code page as indicated. -}; - -struct ole_property -{ - DWORD propid; - DWORD dwType; // type tag - int buflen; - char* buf; -}; - -struct ole_property_set -{ -// FMTID fmtid ; // semantic name of a section - char fmtid[16]; // semantic name of a section - char clsid[16]; // clsid for the creating program - int OSKind; // The OS that created the prop-set - int OSVer; - unsigned int cProps; - struct dictionary * dict; - struct ole_property * pPropList; -}; - -struct ole_property_set * read_ole_properties(char* source_file_name, char* properties_file_name); -void ole_property_set_delete(struct ole_property_set * props); -struct ole_property * get_propterty(struct ole_property_set * props, DWORD propid); - - - -#ifdef __cplusplus -} -#endif diff --git a/st2gpx/src/pushpins.cpp b/st2gpx/src/pushpins.cpp deleted file mode 100644 index 7efd2c90c..000000000 --- a/st2gpx/src/pushpins.cpp +++ /dev/null @@ -1,677 +0,0 @@ -/* - pushpins.cpp - - Extract data from MS Streets & Trips .est, Autoroute .axe - and Mapoint .ptm files in GPX format. - - Copyright (C) 2003 James Sherring, james_sherring@yahoo.com - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111 USA -*/ - -// FIXME (re)use a single db conection for all recordsets for improved performance - -// for vt type values see http://www.canaimasoft.com/f90VB/OnlineManuals/UserManual/TH_99.htm - -//#import "c:\program files\common files\system\ado\msado15.dll" rename ( "EOF", "adoEOF" ) -#import rename ( "EOF", "adoEOF" ) -//#include "msado15.tlh" -//#include "msado15.tli" - -#include -#include // Include only once in your application -#include // for sysstringlength -#include -#include -#include "st2gpx.h" -#include "gpx.h" -#include "pushpins.h" -#include "ppinutil.h" -#include "contents.h" - -struct InitOle { -InitOle() { ::CoInitialize(NULL); } -~InitOle() { ::CoUninitialize(); } -} _init_InitOle_; - - -VARIANT val2variant(unsigned short fieldtype, void* stor_var) -{ - VARIANT vt_val; - vt_val.vt=fieldtype; - - // not sure if this is neccessary - VariantInit(&vt_val); - - switch (fieldtype) - { - case VT_I4: - vt_val.lVal = *(int*)stor_var; - vt_val.vt=fieldtype; - break; - - case VT_I2: - vt_val.iVal = *(short int*)stor_var ; - vt_val.vt=fieldtype; - break; - - case VT_BSTR: - // Note that stor_var must be a pointer to a null-terminated char* string (not unicode) - if ( (stor_var==NULL) || (strlen((char*)stor_var)==0) ) - vt_val.vt=VT_NULL; - else - { - vt_val.vt=fieldtype; - vt_val.bstrVal = _com_util::ConvertStringToBSTR((char*)stor_var); - } - break; - -/* case (VT_ARRAY | VT_UI1): // 8192 | 17 = 8209 - SafeArrayGetLBound(vt_val.parray, 1, &lbound); - SafeArrayGetUBound(vt_val.parray, 1, &ubound); - if( (SafeArrayGetDim(vt_val.parray)!=1) || (lbound !=0) ) - { - printf("got safe array of short ints, with %d dimensions and bounds %d:%d\n", - SafeArrayGetDim(vt_val.parray), lbound, ubound); - printf("Sadly, I was expecting 1 dimention and lower bound of zero, so I will ignore this array.\n"); - break; - } - for(elmt=lbound; elmtpushpin_list = (struct pushpin **)xmalloc(ppin_list_alloc_size*sizeof(struct pushpin *)); - - if (opts.st_version_num<9) - ppin_sql = "SELECT UD_Secondary.UdId, UD_Secondary.UdName, UD_Secondary.NoteTypeId, UD_Secondary.NoteShort, UD_Secondary.NoteLong, UD_Main.Grid, UD_Main.Precision, UD_Main.RenderData, UD_Main.MatchId, UD_Main.MOBBId FROM UD_Main INNER JOIN UD_Secondary ON UD_Main.UdId = UD_Secondary.UdId;"; - else - ppin_sql = "SELECT UdId, UdName, NoteTypeId, NoteShort, NoteLong, Grid, Precision, RenderData, MatchId, MOBBId FROM UD_Main;"; - - try - { - HRESULT hr = S_OK; - ADODB::_RecordsetPtr rs; - char cnstr[500]; - sprintf(cnstr, "PROVIDER=Microsoft.Jet.OLEDB.4.0;data source=%s; Jet OLEDB:Database Password=Geo80;", ppin_file_name); - - hr = rs.CreateInstance( __uuidof( ADODB::Recordset ) ); - - // ***************** - // Read GEODB_LastId - // ***************** - - // FIXME read dbversion, use that instead of file version for setting sql - - // ************* - // read pushpins - // ************* - - hr = rs->Open(ppin_sql, - cnstr, - ADODB::adOpenForwardOnly, - ADODB::adLockReadOnly, - ADODB::adCmdText ); - - while ((rs->adoEOF == FALSE)) - { - ppin = pushpin_new(); - - variant2val(rs->Fields->GetItem("UdId")->Value, VT_I4, &(ppin->UdId), 0); - variant2val(rs->Fields->GetItem("UdName")->Value, VT_BSTR,&(ppin->UdName), 0); - variant2val(rs->Fields->GetItem("Grid")->Value, VT_I4, &(ppin->Grid), 0); - variant2val(rs->Fields->GetItem("Precision")->Value,VT_I4, &(ppin->Precision), 0); - variant2val(rs->Fields->GetItem("NoteTypeId")->Value,VT_I2, &NoteTypeId, 0); - - if(NoteTypeId==1) - variant2val(rs->Fields->GetItem("NoteShort")->Value,VT_BSTR,&(ppin->NoteShort), 0); - else if(NoteTypeId==2) - variant2val(rs->Fields->GetItem("NoteShort")->Value,VT_BSTR,&(ppin->NoteShort), 0); - else - printf("Unexpected NoteTypeId=%d for ppin udid=%d\n", NoteTypeId, ppin->UdId); - - RenderData_len = rs->Fields->GetItem("RenderData")->ActualSize; - val_type = rs->Fields->GetItem("RenderData")->Value.vt; - if(val_type!=VT_NULL) - { - if (RenderData_len==4) - { - variant2val(rs->Fields->GetItem("RenderData")->Value,(VT_ARRAY | VT_UI1), RenderData_buf, RenderData_len); - ppin->RenderData = *(int*)RenderData_buf; - //printf("got pushpin symbol %#x=%d\n", ppin->RenderData, ppin->RenderData); - } - else if (RenderData_len==8) - { - variant2val(rs->Fields->GetItem("RenderData")->Value,(VT_ARRAY | VT_UI1), RenderData_buf, RenderData_len); - ppin->RenderData = *(int*)RenderData_buf; - //printf("got pushpin symbol %#x=%d\n", ppin->RenderData, ppin->RenderData); - ppin->RenderData2 = *(int*)(RenderData_buf+4); - if(ppin->RenderData2 != 0) - { - printf("got pushpin symbol %#x=%d\n", ppin->RenderData, ppin->RenderData); - printf("Got pushpin symbol part2 %#x=%d\n", ppin->RenderData2, ppin->RenderData2); - } - } - else - { - printf("Unexpected RenderData_len=%d\n", RenderData_len); - variant2val(rs->Fields->GetItem("RenderData")->Value,(VT_ARRAY | VT_UI1), RenderData_buf, RenderData_len); - printbuf(RenderData_buf, RenderData_len); - } - } - - variant2val(rs->Fields->GetItem("MatchId")->Value, VT_I2, &(ppin->MatchId), 0); - variant2val(rs->Fields->GetItem("MOBBId")->Value, VT_I4, &(ppin->MOBBId), 0); - - str2ascii(ppin->UdName); - str2ascii(ppin->NoteShort); - - if (opts.verbose_flag > 3) - printf("Read pushpin UdId=%d, UdName=%s, Grid=%d, Precision=%d, NoteShort=%s\n", - ppin->UdId, ppin->UdName, - ppin->Grid, ppin->Precision, ppin->NoteShort); - // what are the valid matchIds? - if (ppin->MatchId==4) - { - printf("Read unmatched pushpin UdId=%d, UdName=%s, Grid=%d, Precision=%d, NoteShort=%s\n", - ppin->UdId, ppin->UdName, - ppin->Grid, ppin->Precision, ppin->NoteShort); - printf("Discarding this pushpin because it is not geocoded (i.e. not matched to map).\n"); - pushpin_delete(ppin); - } - else - { - ppplist->pushpin_list[ppinnum]=ppin; - ppinnum++; - if (ppinnum>ppin_list_alloc_size-1) - { - ppin_list_alloc_size += 100; - ppplist->pushpin_list = (struct pushpin **)xrealloc(ppplist->pushpin_list, ppin_list_alloc_size*sizeof(struct pushpin *)); - } - } - hr = rs->MoveNext(); - } - hr = rs->Close(); - ppplist->num_pushpins=ppinnum; - - // ************* - // read UDM_Data - // ************* - - // always read udm data now - //if (opts.explore_flag) - { - UDM_sql = "Select UdmDataId, UdmData from UDM_Data"; - - hr = rs->Open(UDM_sql, - cnstr, - ADODB::adOpenForwardOnly, - ADODB::adLockReadOnly, - ADODB::adCmdText); - - while ((rs->adoEOF == FALSE)) - { - variant2val(rs->Fields->GetItem("UdmDataId")->Value, VT_I4, &UdmDataId, 0); - if ( (UdmDataId<0) || (UdmDataId>3) ) - { - printf("*** Unexpected UdmDataId=%d\n", UdmDataId); - break; - } - - ppplist->UDM_Data_length[UdmDataId] = rs->Fields->GetItem("UdmData")->ActualSize; - ppplist->UDM_Data[UdmDataId]=(char*)xmalloc(ppplist->UDM_Data_length[UdmDataId]); - variant2val(rs->Fields->GetItem("UdmData")->Value, VT_ARRAY | VT_UI1, ppplist->UDM_Data[UdmDataId], ppplist->UDM_Data_length[UdmDataId] ); - - if(opts.verbose_flag > 3) - printf("In UDM_Data table, for UdId=%d got %d bytes of data\n", - UdmDataId, ppplist->UDM_Data_length[UdmDataId]); - - if (opts.explore_flag) - { - printbuf(ppplist->UDM_Data[UdmDataId], ppplist->UDM_Data_length[UdmDataId]); - } - - hr = rs->MoveNext(); - } - hr = rs->Close(); - - if (opts.explore_flag) - explore_udm_data(ppplist); - - } - - rs = NULL; - - } - catch( _com_error &e) - { - _bstr_t bstrSource(e.Source()); - _bstr_t bs = _bstr_t("*** Exception in read_pushpins(): ") + _bstr_t(e.Error()) + _bstr_t(" Msg: ") - + _bstr_t(e.ErrorMessage()) + _bstr_t(" Description: ") - + _bstr_t(e.Description()); - - wprintf(bs); - printf("\n"); - _flushall(); - - if (opts.verbose_flag>4) - MessageBox(0,bs,bstrSource, MB_OK); - } - - if (opts.verbose_flag > 1) - printf("Read %d pushpins from %s.\n", ppplist->num_pushpins, ppin_file_name); - - return ppplist; -} - -EXTERN_C void write_pushpins_from_gpx(char* ppin_file_name, - struct gpx_data * all_gpx, - struct contents * conts, - char* conts_file_name) -{ - short int DbVersion=0; - int LastSetId=0; - long LastUserDataId=0; - long thisfirstUserDataId=0; - long thisUserDataId=0; - char* sql; - char* sql2; - - // nothing to write - if (all_gpx->wpt_list_count==0) - return; - - try - { - HRESULT hr = S_OK; - ADODB::_RecordsetPtr rs; - ADODB::_RecordsetPtr rs2; - char cnstr[500]; - sprintf(cnstr, "PROVIDER=Microsoft.Jet.OLEDB.4.0;data source=%s; Jet OLEDB:Database Password=Geo80;", ppin_file_name); - - hr = rs.CreateInstance( __uuidof( ADODB::Recordset ) ); - - // ***************** - // Read GEODB_LastId - // ***************** - - sql = "select DbVersion, LastSetId, LastUserDataId from GEODB_LastId"; - hr = rs->Open(sql, - cnstr, - ADODB::adOpenKeyset, - ADODB::adLockOptimistic, - ADODB::adCmdText); - - variant2val(rs->Fields->GetItem("DbVersion")->Value, VT_I2, &DbVersion, 0); - variant2val(rs->Fields->GetItem("LastSetId")->Value, VT_I4, &LastSetId, 0); - variant2val(rs->Fields->GetItem("LastUserDataId")->Value, VT_I4, &LastUserDataId, 0); - - printf("Got DbVersion=%d, LastSetId=%d and LastUserDataId=%d\n", DbVersion, LastSetId, LastUserDataId); - - // ***************** - // update LastSetId, LastUserDataId in GEODB_LastId - // ***************** - - // Later we might import pushpins as different sets, - // but for now we just import as one set - - LastSetId += 1; - thisfirstUserDataId = LastUserDataId +1; - LastUserDataId += all_gpx->wpt_list_count; - - rs->Fields->GetItem("LastSetId" )->Value = val2variant(VT_I4, &LastSetId); - rs->Fields->GetItem("LastUserDataId")->Value = val2variant(VT_I4, &LastUserDataId); - - rs->Update(); - hr = rs->Close(); - //printf("Updated LastSetId, LastUserDataId in GEODB_LastId\n"); - - - // ****************** - // Write all pushpins - // ****************** - - if (opts.st_version_num<9) - { - sql = "Select UdId, SetId, Grid, Precision, RenderData, MatchId, MOBBId, SourceUdId from UD_Main"; - sql2 = "Select UdId, NoteTypeId, GeocodeHierarchy, GeocodeContext, UdName, NoteShort, NoteLong from UD_Secondary"; - hr = rs->Open(sql, - cnstr, - ADODB::adOpenKeyset, - ADODB::adLockOptimistic, - ADODB::adCmdText); - hr = rs2.CreateInstance( __uuidof( ADODB::Recordset ) ); - hr = rs2->Open(sql2, - cnstr, - ADODB::adOpenKeyset, - ADODB::adLockOptimistic, - ADODB::adCmdText); - } - else - { - sql = "Select UdId, SetId, Grid, Precision, RenderData, MatchId, MOBBId, SourceUdId, NoteTypeId, GeocodeHierarchy, GeocodeContext, UdName, NoteShort, NoteLong from UD_Main"; - // maybe we have to do this later, when rs is set? - hr = rs->Open(sql, - cnstr, - ADODB::adOpenKeyset, - ADODB::adLockOptimistic, - ADODB::adCmdText); - } - - - int w; - struct gpxpt * gpt; - struct grid_point gridpt; - long lzero=0; - short int sizero=0; - short int sione=1; - short int sitwo=2; - short int notetype; - - // do for each wpt - for(w=0; wwpt_list_count; w++) - { - if (opts.st_version_num<9) - { - rs->AddNew(); - rs2->AddNew(); - } - else - { - rs->AddNew(); - rs2 = rs; - } - - thisUserDataId=thisfirstUserDataId+w; - gpt = all_gpx->wpt_list[w]; - gridpt=latlon2grid(gpt->lat, gpt->lon); - - //printf("writing ppin with thisUserDataId=%d, gpt->name=%s\n", thisUserDataId, gpt->name); - - rs->Fields->GetItem("UdId" )->Value = val2variant(VT_I4, &thisUserDataId); - rs->Fields->GetItem("SetId" )->Value = val2variant(VT_I2, &LastSetId); - rs->Fields->GetItem("Grid" )->Value = val2variant(VT_I4, &(gridpt.grid)); - rs->Fields->GetItem("Precision" )->Value = val2variant(VT_I4, &(gridpt.precision)); - rs->Fields->GetItem("MatchId" )->Value = val2variant(VT_I2, &sitwo); - // This is stored in the DB as binary type, - // but hopefully it should be ok to write as int. - // FIXME - Potential problem: - // This field has longer maximum width in newer MAP versions. - // Width 32 (AR2001), 64 (MP2002), 128 (AR2003) - - if(gpt->symbol != 0) - rs->Fields->GetItem("RenderData" )->Value = val2variant(VT_I4, &(gpt->symbol)); - rs->Fields->GetItem("MOBBId" )->Value = val2variant(VT_I4, &lzero); - rs->Fields->GetItem("SourceUdId")->Value = val2variant(VT_I4, &lzero); - - if (opts.st_version_num<9) - rs->Update(); - - rs2->Fields->GetItem("UdId" )->Value = val2variant(VT_I4, &thisUserDataId); - rs2->Fields->GetItem("UdName" )->Value = val2variant(VT_BSTR,(gpt->name)); - - if(gpt->desc == NULL) - { - notetype=1; - } - else if(strlen(gpt->desc) < 255) - { - notetype=1; - rs2->Fields->GetItem("NoteShort")->Value = val2variant(VT_BSTR,(gpt->desc)); - } - else - { - notetype=2; - rs2->Fields->GetItem("NoteLong")->Value = val2variant(VT_BSTR,(gpt->desc)); - } - rs2->Fields->GetItem("NoteTypeId")->Value = val2variant(VT_I2, ¬etype); - rs2->Fields->GetItem("GeocodeHierarchy")->Value = val2variant(VT_I2, &sizero); - rs2->Fields->GetItem("GeocodeContext" )->Value = val2variant(VT_I4, &lzero); - // sometime I should support this - // rs2->Fields->GetItem("NoteLong" )->Value = val2variant(?, NULL); - rs2->Update(); - } - - if (opts.st_version_num<9) - { - rs->Close(); - rs2->Close(); - rs2 = NULL; - } - else - { - rs->Close(); - } - - //printf("Inserted all pushpin records\n"); - - // ********************** - // insert row in SET_Main, - // ********************** - - // SetId, SetName, UdCount, MatchedCount - - // FIXME cant I use a compiler var for size of largest short? - if (LastSetId>(1<<15)) - printf("too many set ids!"); - short int SetId=(short int)LastSetId; - - char* SetName = all_gpx->data_source_name; - short int RenderMethod = 2; - short int GeocodeMethod = 3; //5; - short int CreateMethod = 1; // using 2 causes mp to crash - short int GeometryType = 1; - long UdCount=all_gpx->wpt_list_count; - long MatchedCount=all_gpx->wpt_list_count; - long SkippedCount = 0; - long UnmatchedCount = 0; - long CounterUpdateMask=0; - short int ParentSetId=0; - short int IsRendered=-1; - long Z_Order=0; //5000; - long GeocodeCtxt=39070; // ??? - int HLnkSrc=3; - long HLnkColId=0; - - if(opts.st_version_num<9) - sql = "SELECT SetId, SetName, RenderMethod, GeocodeMethod, CreateMethod, GeometryType, UdCount, MatchedCount, SkippedCount, UnmatchedCount, CounterUpdateMask, ParentSetId, IsRendered, Z_Order, GeocodeCtxt FROM SET_Main"; - else - sql = "SELECT SetId, SetName, RenderMethod, GeocodeMethod, CreateMethod, GeometryType, UdCount, MatchedCount, SkippedCount, UnmatchedCount, CounterUpdateMask, ParentSetId, IsRendered, Z_Order, GeocodeCtxt, HLnkSrc, HLnkColId FROM SET_Main"; - - hr = rs->Open(sql, - cnstr, - ADODB::adOpenKeyset, - ADODB::adLockOptimistic, - ADODB::adCmdText); - - rs->AddNew(); - - rs->Fields->GetItem("SetId" )->Value = val2variant(VT_I2, &SetId); - rs->Fields->GetItem("SetName" )->Value = val2variant(VT_BSTR, SetName); - rs->Fields->GetItem("RenderMethod" )->Value = val2variant(VT_I2, &RenderMethod); - rs->Fields->GetItem("GeocodeMethod" )->Value = val2variant(VT_I2, &GeocodeMethod); - rs->Fields->GetItem("CreateMethod" )->Value = val2variant(VT_I2, &CreateMethod); - rs->Fields->GetItem("GeometryType" )->Value = val2variant(VT_I2, &GeometryType); - rs->Fields->GetItem("UdCount" )->Value = val2variant(VT_I4, &UdCount); - rs->Fields->GetItem("MatchedCount" )->Value = val2variant(VT_I4, &MatchedCount); - rs->Fields->GetItem("SkippedCount" )->Value = val2variant(VT_I4, &SkippedCount); - rs->Fields->GetItem("UnmatchedCount" )->Value = val2variant(VT_I4, &UnmatchedCount); - rs->Fields->GetItem("CounterUpdateMask" )->Value = val2variant(VT_I4, &CounterUpdateMask); - rs->Fields->GetItem("ParentSetId" )->Value = val2variant(VT_I2, &ParentSetId); - rs->Fields->GetItem("IsRendered" )->Value = val2variant(VT_I2, &IsRendered); - rs->Fields->GetItem("Z_Order" )->Value = val2variant(VT_I4, &Z_Order); - rs->Fields->GetItem("GeocodeCtxt" )->Value = val2variant(VT_I4, &GeocodeCtxt); - - if(opts.st_version_num>8) - { - rs->Fields->GetItem("HLnkSrc" )->Value = val2variant(VT_I2, &HLnkSrc); - rs->Fields->GetItem("HLnkColId" )->Value = val2variant(VT_I4, &HLnkColId); - } - - rs->Update(); - rs->Close(); - - - // *************************** - // construct & update UDM_data - // *************************** - - // we need to do this to show ppin name, info, symbol etc - - // ******************* - // COM / ADO clean up - // ******************* - - rs = NULL; - if (rs2) - rs2 = NULL; - - // ***************** - // update contents - // ***************** - - struct contents * mod_conts = contents_insert_ppinset(conts, (unsigned short)LastSetId); - if (mod_conts!=NULL) - { - write_contents(mod_conts, conts_file_name); - contents_delete(mod_conts); - - printf("Wrote %d waypoints as PushPins\n", all_gpx->wpt_list_count); - debug_pause(); - } - else - printf("failed to successfully write pushpins, output is now corrupt.\n"); - } - catch( _com_error &e) - { - _bstr_t bstrSource(e.Source()); - _bstr_t bs = _bstr_t("*** Exception in write_pushpins_from_gpx(): ") + _bstr_t(e.Error()) + _bstr_t(" Msg: ") - + _bstr_t(e.ErrorMessage()) + _bstr_t(" Description: ") - + _bstr_t(e.Description()); - - wprintf(bs); - printf("\n"); - _flushall(); - -// if (opts.verbose_flag>4) - MessageBox(0,bs,bstrSource, MB_OK); - } - -} diff --git a/st2gpx/src/pushpins.h b/st2gpx/src/pushpins.h deleted file mode 100644 index b6f486bf4..000000000 --- a/st2gpx/src/pushpins.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - pushpins.h - - Extract data from MS Streets & Trips .est, Autoroute .axe - and Mapoint .ptm files in GPX format. - - Copyright (C) 2003 James Sherring, james_sherring@yahoo.com - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111 USA - -*/ - -#ifdef __cplusplus -extern "C" { -#endif - -//EXTERN_C -struct pushpin_safelist * read_pushpins(char* ppin_file_name); -//EXTERN_C -void write_pushpins_from_gpx(char* ppin_file_name, - struct gpx_data * all_gpx, - struct contents * conts, - char* conts_file_name); -#ifdef __cplusplus -} /* closing brace for extern "C" */ -#endif diff --git a/st2gpx/src/readgpx.c b/st2gpx/src/readgpx.c deleted file mode 100644 index 631a6cbe3..000000000 --- a/st2gpx/src/readgpx.c +++ /dev/null @@ -1,836 +0,0 @@ -/* - readgpx.c - - Extract data from MS Streets & Trips .est, Autoroute .axe - and Mapoint .ptm files in GPX format. - - Copyright (C) 2003 James Sherring, james_sherring@yahoo.com - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111 USA - - - This app depends on istorage & istorage-make from Pabs (pabs3@zip.to) - and James Clark's Expat xml parser from http://www.libexpat.org/. - -*/ - -#include -#include -#include - -#include -#include "gpx.h" -#include "st2gpx.h" - -typedef void (*gpx_elm_start_handler)(void *, const char *, const char **); -typedef void (*gpx_elm_end_handler)(void *, const char *); - -int current_main_element=0; -int current_element=0; -static XML_Char * cdata; -static int cdata_length; - -//FILE* gpx_in_file=NULL; - -char * gpx_elem_name[] = -{ - "unknown-element", - "wpt", - "rte", - "rtept", - "trk", - "trkseg", - "trkpt", - "name", - "desc", - "src", - "sym", - "type", - "url", - "urlname" -}; - -struct gpxpt * gpxpt_new() -{ - struct gpxpt * nw = (struct gpxpt *)xmalloc(sizeof(struct gpxpt)); - nw->name=NULL; - nw->desc=NULL; - nw->lat=0; - nw->lon=0; - nw->elevation=0; - nw->use_elevation=0; - nw->symbol=0; - nw->url=NULL; - nw->urlname=NULL; - return nw; -} - -void gpxpt_delete(struct gpxpt * pt) -{ - if(pt==NULL) - return; - free(pt->name); - free(pt->desc); - free(pt->url); - free(pt->urlname); - free(pt); -} - -struct gpxpt * gpxpt_copy(struct gpxpt * otherpt) -{ - struct gpxpt * nw = (struct gpxpt *)xmalloc(sizeof(struct gpxpt)); - nw->name = _strdup(otherpt->name); - nw->desc = _strdup(otherpt->desc); - nw->lat=otherpt->lat; - nw->lon=otherpt->lon; - nw->elevation=otherpt->elevation; - nw->use_elevation=otherpt->use_elevation; - nw->symbol = otherpt->symbol; - nw->url = _strdup(otherpt->url); - nw->urlname = _strdup(otherpt->urlname); - return nw; -} - -struct gpxpt * find_matching_wpt(struct gpx_data * dat, char* name) -{ - int i; - struct gpxpt * match = NULL; - for(i=0; iwpt_list_count; i++) - if(strcmp(name, dat->wpt_list[i]->name)==0) - { - match = dat->wpt_list[i]; - break; - } - return match; -} - -struct gpxrte * gpxrte_new() -{ - struct gpxrte * nw = (struct gpxrte *)xmalloc(sizeof(struct gpxrte)); - nw->name=NULL; - nw->rtept_list=NULL; - nw->rtept_list_count=0; - return nw; -} - -void gpxrte_delete(struct gpxrte * rte) -{ - int i; - if(rte==NULL) - return; - for (i=0; irtept_list_count; i++) - gpxpt_delete(rte->rtept_list[i]); - free(rte->rtept_list); - free(rte->name); - free(rte); -} - -struct gpxtrk * gpxtrk_new() -{ - struct gpxtrk * nw = (struct gpxtrk *)xmalloc(sizeof(struct gpxtrk)); - nw->trkpt_list=NULL; - nw->trkpt_list_count=0; - return nw; -} - -void gpxtrk_delete(struct gpxtrk * trk) -{ - int i; - if(trk==NULL) - return; - for (i=0; itrkpt_list_count; i++) - gpxpt_delete(trk->trkpt_list[i]); - free(trk->trkpt_list); - free(trk); -} - -struct gpx_data * gpx_data_new() -{ - struct gpx_data * all_data = (struct gpx_data *)xmalloc(sizeof(struct gpx_data)); - all_data->data_source_name=NULL; - all_data->wpt_list=NULL; - all_data->wpt_list_count=0; - all_data->rte_list=NULL; - all_data->rte_list_count=0; - all_data->trk_list=NULL; - all_data->trk_list_count=0; - return all_data; -} - -void gpx_data_delete(struct gpx_data * data) -{ - int i; - if(data==NULL) - return; - - free(data->data_source_name); - for (i=0; iwpt_list_count; i++) - gpxpt_delete(data->wpt_list[i]); - for (i=0; irte_list_count; i++) - gpxrte_delete(data->rte_list[i]); - for (i=0; itrk_list_count; i++) - gpxtrk_delete(data->trk_list[i]); - free(data->wpt_list); - free(data->rte_list); - free(data->trk_list); - free(data); -} - -void print_wptlist(struct gpxpt ** wpt_list, int wpt_list_count) -{ - int i; - printf("Global waypoints:\n"); - for (i=0; ilat, wpt_list[i]->lon, wpt_list[i]->name, wpt_list[i]->desc); -} - -void print_route(struct gpxrte * rte) -{ - int i; - printf("Route '%s' with %d route-points:\n", rte->name, rte->rtept_list_count); - for (i=0; irtept_list_count; i++) - printf("rtept: lat=%f, lon=%f, name='%s', desc='%s'\n", - (rte->rtept_list)[i]->lat, (rte->rtept_list)[i]->lon, - (rte->rtept_list)[i]->name, (rte->rtept_list)[i]->desc); -} - -void print_route_list(struct gpxrte ** rte_list, int rte_list_count) -{ - int i; - printf("Global route list with %d routes:\n", rte_list_count); - for (i=0; itrkpt_list_count); - for (i=0; itrkpt_list_count; i++) - printf("trkpt: lat=%f, lon=%f\n", - trk->trkpt_list[i]->lat, trk->trkpt_list[i]->lon); -} - -void print_track_list(struct gpxtrk ** trk_list, int trk_list_count) -{ - int i; - printf("Global track list with %d tracks:\n", trk_list_count); - for (i=0; iwpt_list, all_data->wpt_list_count); - print_route_list(all_data->rte_list, all_data->rte_list_count); - print_track_list(all_data->trk_list, all_data->trk_list_count); -} - -char* get_att(char* match, const char **atts) -{ - const char **avp = &atts[0]; - while (*avp) { - if (strcmp(avp[0], match) == 0) - return (char *)avp[1]; - avp+=2; - } - return NULL; -} - -void startunkn(void *userData, const char *name, const char **atts) -{ - if(opts.verbose_flag > 3) - printf("ignoring start element name %s\n", name); -} - -void endunkn(void *userData, const char *name) -{ - if(opts.verbose_flag > 3) - printf("ignoring end element name %s\n", name); -} - -void startwpt(void *userData, const char *name, const char **atts) -{ - struct gpx_data * dat = (struct gpx_data *)userData; - - if (current_main_element!=0) - { - printf("unexpected element\n"); - debug_pause(); - exit(1); - } - current_main_element=GPX_ELEM_TYPE_WPT; - - dat->wpt_list=(struct gpxpt **)xrealloc(dat->wpt_list, (dat->wpt_list_count+1)*sizeof(struct gpxpt *)); - dat->wpt_list[dat->wpt_list_count] = gpxpt_new(); - - sscanf(get_att("lat", atts), "%lf", &(dat->wpt_list[dat->wpt_list_count]->lat)); - sscanf(get_att("lon", atts), "%lf", &(dat->wpt_list[dat->wpt_list_count]->lon)); - dat->wpt_list_count++; -} - -void endwpt(void *userData, const char *name) -{ - if (current_main_element!=GPX_ELEM_TYPE_WPT) - { - printf("unexpected element\n"); - debug_pause(); - exit(1); - } - current_main_element=0; -} - -void startrte(void *userData, const char *name, const char **atts) -{ - struct gpx_data * dat = (struct gpx_data *)userData; - - if (current_main_element!=0) - { - printf("unexpected element\n"); - debug_pause(); - exit(1); - } - current_main_element=GPX_ELEM_TYPE_RTE; - - dat->rte_list=(struct gpxrte **)xrealloc(dat->rte_list, (dat->rte_list_count+1)*sizeof(struct gpxrte *)); - dat->rte_list[dat->rte_list_count]=gpxrte_new(); -// dat->rte_list[dat->rte_list_count]->name="{get route name from a following element}"; - dat->rte_list_count++; -} - -void endrte(void *userData, const char *name) -{ - if (current_main_element!=GPX_ELEM_TYPE_RTE) - { - printf("unexpected element\n"); - debug_pause(); - exit(1); - } - current_main_element=0; -} - -void startrtept(void *userData, const char *name, const char **atts) -{ - struct gpx_data * dat = (struct gpx_data *)userData; - struct gpxrte * thisrte = dat->rte_list[dat->rte_list_count-1]; - - if (current_main_element!=GPX_ELEM_TYPE_RTE) - { - printf("unexpected element\n"); - debug_pause(); - exit(1); - } - current_main_element=GPX_ELEM_TYPE_RTEPT; - - thisrte->rtept_list=(struct gpxpt **)xrealloc(thisrte->rtept_list, - (thisrte->rtept_list_count+1)*sizeof(struct gpxpt *)); - thisrte->rtept_list[thisrte->rtept_list_count] = gpxpt_new(); - sscanf(get_att("lat", atts), "%lf", &(thisrte->rtept_list[thisrte->rtept_list_count]->lat)); - sscanf(get_att("lon", atts), "%lf", &(thisrte->rtept_list[thisrte->rtept_list_count]->lon)); - thisrte->rtept_list_count++; -} - -void endrtept(void *userData, const char *name) -{ - if (current_main_element!=GPX_ELEM_TYPE_RTEPT) - { - printf("unexpected element\n"); - debug_pause(); - exit(1); - } - current_main_element=GPX_ELEM_TYPE_RTE; -} - -void starttrk(void *userData, const char *name, const char **atts) -{ - struct gpx_data * dat = (struct gpx_data *)userData; - - if (current_main_element!=0) - { - printf("unexpected element\n"); - debug_pause(); - exit(1); - } - current_main_element=GPX_ELEM_TYPE_TRK; - - dat->trk_list=(struct gpxtrk **)xrealloc(dat->trk_list, (dat->trk_list_count+1)*sizeof(struct gpxtrk *)); - dat->trk_list[dat->trk_list_count]=gpxtrk_new(); - dat->trk_list_count++; -} - -void endtrk(void *userData, const char *name) -{ -// struct gpx_data * dat = (struct gpx_data *)userData; - - if (current_main_element!=GPX_ELEM_TYPE_TRK) - { - printf("unexpected element\n"); - debug_pause(); - exit(1); - } - current_main_element=0; - -// printf("read end of track%d, with %d points\n", -// dat->trk_list_count, -// dat->trk_list[dat->trk_list_count-1]->trkpt_list_count); -} - -// just eat : we join all track segments as a single track - -void starttrkseg(void *userData, const char *name, const char **atts) -{ - if (current_main_element!=GPX_ELEM_TYPE_TRK) - { - printf("unexpected element\n"); - debug_pause(); - exit(1); - } - current_main_element=GPX_ELEM_TYPE_TRKSEG; -} - -void endtrkseg(void *userData, const char *name) -{ - if (current_main_element!=GPX_ELEM_TYPE_TRKSEG) - { - printf("unexpected element\n"); - debug_pause(); - exit(1); - } - current_main_element=GPX_ELEM_TYPE_TRK; -} - -void starttrkpt(void *userData, const char *name, const char **atts) -{ - struct gpx_data * dat = (struct gpx_data *)userData; - struct gpxtrk * thistrk = dat->trk_list[dat->trk_list_count-1]; - - if (current_main_element!=GPX_ELEM_TYPE_TRKSEG) - { - printf("unexpected element\n"); - debug_pause(); - exit(1); - } - current_main_element=GPX_ELEM_TYPE_TRKPT; - - thistrk->trkpt_list=(struct gpxpt **)xrealloc(thistrk->trkpt_list, - (thistrk->trkpt_list_count+1)*sizeof(struct gpxpt *)); - thistrk->trkpt_list[thistrk->trkpt_list_count]=gpxpt_new(); - sscanf(get_att("lat", atts), "%lf", &(thistrk->trkpt_list[thistrk->trkpt_list_count]->lat)); - sscanf(get_att("lon", atts), "%lf", &(thistrk->trkpt_list[thistrk->trkpt_list_count]->lon)); - thistrk->trkpt_list_count++; -} - -void endtrkpt(void *userData, const char *name) -{ - if (current_main_element!=GPX_ELEM_TYPE_TRKPT) - { - printf("unexpected element\n"); - debug_pause(); - exit(1); - } - current_main_element=GPX_ELEM_TYPE_TRKSEG; -} - -void startname(void *userData, const char *name, const char **atts) -{ -} - -void endname(void *userData, const char *name) -{ - struct gpx_data * dat = (struct gpx_data *)userData; - struct gpxrte* thisrte; -// struct gpxtrk* thistrk; - char* nameval = xrealloc(cdata, (cdata_length+1)*sizeof(XML_Char)); - nameval[cdata_length]=0; - cdata=NULL; - cdata_length=0; - str2ascii(nameval); - switch (current_main_element) - { - case GPX_ELEM_TYPE_WPT: - dat->wpt_list[dat->wpt_list_count-1]->name=nameval; - break; - case GPX_ELEM_TYPE_RTE: - dat->rte_list[dat->rte_list_count-1]->name=nameval; - break; - case GPX_ELEM_TYPE_RTEPT: - thisrte = dat->rte_list[dat->rte_list_count-1]; - thisrte->rtept_list[thisrte->rtept_list_count-1]->name=nameval; - break; - case GPX_ELEM_TYPE_TRK: -// thistrk = dat->trk_list[dat->trk_list_count-1]; -// thistrk->trkpt_list[thistrk->trkpt_list_count-1]->name=nameval; - //break; - case GPX_ELEM_TYPE_TRKSEG: - //break; - case GPX_ELEM_TYPE_TRKPT: - default: - free(nameval); - break; - } -} - -void startdesc(void *userData, const char *name, const char **atts) -{ -} - -void enddesc(void *userData, const char *name) -{ - struct gpx_data * dat = (struct gpx_data *)userData; -// struct gpxrte* thisrte; -// struct gpxtrk* thistrk; - char* desc = xrealloc(cdata, cdata_length+1); - desc[cdata_length]=0; - cdata=NULL; - cdata_length=0; - switch (current_main_element) - { - case GPX_ELEM_TYPE_WPT: - str2ascii(desc); - dat->wpt_list[dat->wpt_list_count-1]->desc=desc; - break; - case GPX_ELEM_TYPE_RTE: -// dat->rte_list[dat->rte_list_count-1]->desc=desc; -// break; - case GPX_ELEM_TYPE_RTEPT: -// thisrte = dat->rte_list[dat->rte_list_count-1]; -// thisrte->rtept_list[thisrte->rtept_list_count-1]->desc=desc; -// break; - case GPX_ELEM_TYPE_TRK: -// thistrk = dat->trk_list[dat->trk_list_count-1]; -// thistrk->trkpt_list[thistrk->trkpt_list_count-1]->desc=desc; -// break; - case GPX_ELEM_TYPE_TRKSEG: -// break; - case GPX_ELEM_TYPE_TRKPT: - default: - free(desc); - break; - } -} - -void startsrc(void *userData, const char *name, const char **atts) -{ -} - -void endsrc(void *userData, const char *name) -{ -} - -void startsym(void *userData, const char *name, const char **atts) -{ -} - -void endsym(void *userData, const char *name) -{ - struct gpx_data * dat = (struct gpx_data *)userData; - char* sym_str = xrealloc(cdata, cdata_length+1); - int sym_num=0; - int read; - - sym_str[cdata_length]=0; - cdata=NULL; - cdata_length=0; - - - // We need to convert the name of the symbol sym_str from GPX - // into a numeric symbol number for MS Map. - // For now we just accept MS Map Symbol n - -/* if (strncmp(sym_str, "MS Map Symbol", 13)!=0) - { - free(sym_str); - return; - } -*/ - read=sscanf(sym_str, "MS Map Symbol %d", &sym_num); - - if( (read==1) && (sym_num>0) ) - printf("Translated symbol name %s as symbol number %d\n", sym_str, sym_num); - else - { - printf("Couldn't translate symbol name %s to a symbol number\n", sym_str); - free(sym_str); - return; - } - - switch (current_main_element) - { - case GPX_ELEM_TYPE_WPT: - // We may have already set the symbol from , - // which over-rides the symbol. - // Fixme this override should eb an option, not the default. - if(dat->wpt_list[dat->wpt_list_count-1]->symbol == 0) - dat->wpt_list[dat->wpt_list_count-1]->symbol=sym_num; - break; - case GPX_ELEM_TYPE_RTE: - case GPX_ELEM_TYPE_RTEPT: - case GPX_ELEM_TYPE_TRK: - case GPX_ELEM_TYPE_TRKSEG: - case GPX_ELEM_TYPE_TRKPT: - default: - break; - } - - free(sym_str); -} - -void starttype(void *userData, const char *name, const char **atts) -{ -} - -void endtype(void *userData, const char *name) -{ - struct gpx_data * dat = (struct gpx_data *)userData; - char* type_str = xrealloc(cdata, cdata_length+1); - int sym_num=0; - - type_str[cdata_length]=0; - cdata=NULL; - cdata_length=0; - - if(strcmp(type_str, "Geocache|Virtual Cache")==0) - sym_num=68; // balloon - else if(strcmp(type_str, "Geocache|Traditional Cache")==0) - sym_num=55; // small purple or green triange - else if(strcmp(type_str, "Geocache|Multi-Cache")==0) - sym_num=107; // three flags - //sym_num=132; // traffic-light - else if(strcmp(type_str, "Geocache|Unknown Cache")==0) - sym_num=254; // question-mark - else if(strcmp(type_str, "Geocache|Micro-Cache")==0) - sym_num=65; // rotor/X - else if(strcmp(type_str, "Geocache|Event Cache")==0) - sym_num=138; // knife & fork - - switch (current_main_element) - { - case GPX_ELEM_TYPE_WPT: - if(sym_num != 0) - dat->wpt_list[dat->wpt_list_count-1]->symbol=sym_num; - break; - case GPX_ELEM_TYPE_RTE: - case GPX_ELEM_TYPE_RTEPT: - case GPX_ELEM_TYPE_TRK: - case GPX_ELEM_TYPE_TRKSEG: - case GPX_ELEM_TYPE_TRKPT: - default: - break; - } - - free(type_str); -} - -void starturl(void *userData, const char *name, const char **atts) -{ -} - -void endurl(void *userData, const char *name) -{ - struct gpx_data * dat = (struct gpx_data *)userData; - char* url_str = xrealloc(cdata, cdata_length+1); - - url_str[cdata_length]=0; - cdata=NULL; - cdata_length=0; - - switch (current_main_element) - { - case GPX_ELEM_TYPE_WPT: - dat->wpt_list[dat->wpt_list_count-1]->url=url_str; - break; - case GPX_ELEM_TYPE_RTE: - case GPX_ELEM_TYPE_RTEPT: - case GPX_ELEM_TYPE_TRK: - case GPX_ELEM_TYPE_TRKSEG: - case GPX_ELEM_TYPE_TRKPT: - default: - break; - free(url_str); - } - -} - -void starturlname(void *userData, const char *name, const char **atts) -{ -} - -void endurlname(void *userData, const char *name) -{ - struct gpx_data * dat = (struct gpx_data *)userData; - char* url_str = xrealloc(cdata, cdata_length+1); - - url_str[cdata_length]=0; - cdata=NULL; - cdata_length=0; - - switch (current_main_element) - { - case GPX_ELEM_TYPE_WPT: - dat->wpt_list[dat->wpt_list_count-1]->urlname=url_str; - break; - case GPX_ELEM_TYPE_RTE: - case GPX_ELEM_TYPE_RTEPT: - case GPX_ELEM_TYPE_TRK: - case GPX_ELEM_TYPE_TRKSEG: - case GPX_ELEM_TYPE_TRKPT: - default: - break; - free(url_str); - } - -} - -#define GPX_NUM_ELEM_HANDLERS 14 - -gpx_elm_start_handler gpx_start_elm_handler[] = -{ - &startunkn, - &startwpt, - &startrte, - &startrtept, - &starttrk, - &starttrkseg, - &starttrkpt, - &startname, - &startdesc, - &startsrc, - &startsym, - &starttype, - &starturl, - &starturlname -}; - -gpx_elm_end_handler gpx_end_elm_handler[] = -{ - &endunkn, - &endwpt, - &endrte, - &endrtept, - &endtrk, - &endtrkseg, - &endtrkpt, - &endname, - &enddesc, - &endsrc, - &endsym, - &endtype, - &endurl, - &endurlname -}; - -int get_gpx_type_ndx(const char* type_name) -{ - int i; - for (i=1; idata_source_name=(char*)xmalloc(strlen(gpx_in_file_name)+1); - strcpy(all_data->data_source_name, gpx_in_file_name); - - XML_SetUserData(parser, all_data); - XML_SetElementHandler(parser, startElement, endElement); - XML_SetCharacterDataHandler(parser, CharacterData); - - if(gpx_in_file_name==NULL) - { - fprintf(stderr, "Unexpected null filename for gpx_in_file_name\n"); - debug_pause(); - exit(1); - } - else - { - printf("Importing data from %s\n", gpx_in_file_name); - gpx_in_file = fopen(gpx_in_file_name, "r"); - } - - if(gpx_in_file==NULL) - { - fprintf(stderr, "Unable to open GPX file %s\n", gpx_in_file_name); - debug_pause(); - exit(1); - } - - do - { - size_t len = fread(buf, 1, sizeof(buf), gpx_in_file); - done = len < sizeof(buf); - if (XML_Parse(parser, buf, len, done) == XML_STATUS_ERROR) - { - fprintf(stderr, - "%s at line %d\n", - XML_ErrorString(XML_GetErrorCode(parser)), - XML_GetCurrentLineNumber(parser)); - return all_data; - } - } while (!done); - XML_ParserFree(parser); - - if (opts.verbose_flag > 2) - { - } - - free(cdata); - - return all_data; -} diff --git a/st2gpx/src/readmpst.c b/st2gpx/src/readmpst.c deleted file mode 100644 index 261761c30..000000000 --- a/st2gpx/src/readmpst.c +++ /dev/null @@ -1,401 +0,0 @@ -/* - readmpst.c - - Extract data from MS Streets & Trips .est, Autoroute .axe - and Mapoint .ptm files in GPX format. - - Copyright (C) 2003 James Sherring, james_sherring@yahoo.com - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111 USA - - - This app depends on istorage & istorage-make from Pabs (pabs3@zip.to) - and James Clark's Expat xml parser from http://www.libexpat.org/. - -*/ -#include -#include -#include - -#include "st2gpx.h" -#include "gpx.h" - -#define STATUS_BOF 1 -#define STATUS_EOF 2 -#define STATUS_FILE_HEADER 3 - -#define STATUS_WPT_LIST_HEADER 4 -#define STATUS_WPT_LIST_BODY 5 - -#define STATUS_RTE_LIST_HEADER 6 -#define STATUS_RTE_ITEM 7 -#define STATUS_RTE_PT_LIST_HEADER 8 -#define STATUS_RTE_PT_LIST_BODY 9 - -#define STATUS_TRK_LIST_HEADER 10 -#define STATUS_TRK_ITEM 11 -#define STATUS_TRK_PT_LIST_HEADER 12 -#define STATUS_TRK_PT_LIST_BODY 13 - -#define MAX_FIELD_WIDTH 50 -// I have files with 1300 lines -#define MAX_LINES 10000 -//#define MAX_LINES 200 - -//#define MAX_FIELDS 20; -//char* list_header_fieldnames[MAX_FIELDS]; -//char* list_header_values[MAX_FIELDS]; -//char* list_fieldnames[MAX_FIELDS]; -//char* list_values[MAX_FIELDS]; - -const char* garmin_16_symbols[16]= -{ - "Waypoint", - "Residence", - "Gas Station", - "Car", - "Fishing Area", - "Boat Ramp", - "Marina", - "Shipwreck", - "Exit", - "Skull and Crossbones", - "Flag", - "Campground", - "Circle with X", - "Hunting Area", - "Medical Facility", - "TrackBack Point" -}; - -struct gpx_data * read_mpstext(char* mpstxt_file_name) -{ - char line_buf[1001]; - FILE* mpstxt_file = fopen(mpstxt_file_name, "r"); - //int byte_read; - int status=STATUS_FILE_HEADER; - int last_status=STATUS_BOF; - int this_blank=0; - int last_blank=0; - char * fgets_status; - int parsed_vars=0; - - int loop_count=0; - - // being lazy a lot of large variables - char f_Name[ MAX_FIELD_WIDTH ]; - char f_Desc[ MAX_FIELD_WIDTH ]; - char f_Type[ MAX_FIELD_WIDTH ]; - char f_lat_dir; - double f_lat; - char f_lon_dir; - double f_lon; - char f_Altitude[ MAX_FIELD_WIDTH ]; - char f_Depth[ MAX_FIELD_WIDTH ]; - char f_Proximity[ MAX_FIELD_WIDTH ]; - char f_DisplayMode[ MAX_FIELD_WIDTH ]; - char f_Color[ MAX_FIELD_WIDTH ]; - char f_Symbol[ MAX_FIELD_WIDTH ]; - char f_Facility[ MAX_FIELD_WIDTH ]; - char f_City[ MAX_FIELD_WIDTH ]; - char f_State[ MAX_FIELD_WIDTH ]; - char f_Country[ MAX_FIELD_WIDTH ]; - - char f_Length[ MAX_FIELD_WIDTH ]; - char f_Course[ MAX_FIELD_WIDTH ]; - char Waypoints[ MAX_FIELD_WIDTH ]; - - char f_WaypointName[ MAX_FIELD_WIDTH ]; - char f_Distance[ MAX_FIELD_WIDTH ]; - char f_LegLength[ MAX_FIELD_WIDTH ]; - - char f_StartTime[ MAX_FIELD_WIDTH ]; - char f_ElapsedTime[ MAX_FIELD_WIDTH ]; - char f_AverageSpeed[ MAX_FIELD_WIDTH ]; - char f_DateTime[ MAX_FIELD_WIDTH ]; - char f_LegTime[ MAX_FIELD_WIDTH ]; - char f_LegSpeed[ MAX_FIELD_WIDTH ]; - char f_LegCourse[ MAX_FIELD_WIDTH ]; - - struct gpx_data * dat = gpx_data_new(); - struct gpxpt * this_gpxpt=NULL; - struct gpxpt * matching_wpt=NULL; - struct gpxrte * thisrte=NULL; - - dat->data_source_name=(char*)xmalloc(strlen(mpstxt_file_name)+1); - strcpy(dat->data_source_name, mpstxt_file_name); - - if (mpstxt_file==NULL) - { - printf("Error opening MapSource text file %s for input\n", mpstxt_file_name); - debug_pause(); - exit(1); - } - else - printf("Reading MapSource text file %s\n", mpstxt_file_name); - - while (status!=STATUS_EOF) - { - fgets_status = fgets((char*)line_buf, 1000, mpstxt_file); - if (fgets_status==NULL) - status=STATUS_EOF; - - //printf("read %d bytes in line: %s\n", bytes_read, line_buf); - - if (strcmp(line_buf,"\n")==0) - this_blank=1; - else - this_blank=0; - - switch(status) - { - case STATUS_FILE_HEADER: - // Just eat all header lines until a this_blank line - // We should verify this header - - // FIXME We need to check that Grid=Lat/Lon hddd.ddddd° - // to be sure we can read the data - if (this_blank) - status=STATUS_WPT_LIST_HEADER; - break; - - case STATUS_WPT_LIST_HEADER: - // check type & set proper status - if (this_blank) - status=STATUS_WPT_LIST_BODY; - break; - - case STATUS_WPT_LIST_BODY: - if (this_blank) - { - status=STATUS_RTE_LIST_HEADER; - } - else - { - parsed_vars=sscanf(line_buf, "Waypoint\t%[^\t]\t%[^\t]\t%[^\t]\t%c%lf %c%lf\t%[^\t]\t%[^\t]\t%[^\t]\t%[^\t]\t%[^\t]\t%[^\t]\t%[^\t]\t%[^\t]\t%[^\t]\t%[^\t]", - &f_Name, &f_Desc, &f_Type, &f_lat_dir, &f_lat, &f_lon_dir, &f_lon, &f_Altitude, - &f_Depth, &f_Proximity, &f_DisplayMode, &f_Color, &f_Symbol, &f_Facility, - &f_City, &f_State, &f_Country); - if (parsed_vars<4) - { - printf("Error parsing line %d as a waypoint. Need at least 4 vars, only got %d\n", - loop_count+1, parsed_vars); - printf("Problem line is: %s\n", line_buf); - } - else - { - dat->wpt_list=(struct gpxpt **)xrealloc(dat->wpt_list, (dat->wpt_list_count+1)*sizeof(struct gpxpt *)); - this_gpxpt = dat->wpt_list[dat->wpt_list_count] = gpxpt_new(); - - if (f_lat_dir=='S') - f_lat=-f_lat; - else if(f_lat_dir!='N') - printf("Error parsing line %d as a waypoint. '%c' when expecting 'N' or 'S' for latitdue.\n", f_lat_dir); - - if (f_lon_dir=='W') - f_lon=-f_lon; - else if(f_lon_dir!='E') - printf("Error parsing line %d as a waypoint. '%c' when expecting 'E' or 'W' for longitude.\n", f_lat_dir); - - this_gpxpt->lat = f_lat; - this_gpxpt->lon = f_lon; - this_gpxpt->name=xmalloc(strlen(f_Name)+1); - strcpy(this_gpxpt->name, f_Name); - str2ascii(this_gpxpt->name); - this_gpxpt->desc=xmalloc(strlen(f_Desc)+1); - strcpy(this_gpxpt->desc, f_Desc); - str2ascii(this_gpxpt->desc); - dat->wpt_list_count++; - } - } - break; - - case STATUS_RTE_LIST_HEADER: - // check type & set proper status - if (this_blank && !last_blank) - status=STATUS_RTE_ITEM; - break; - - case STATUS_RTE_ITEM: - if (this_blank) - { - if (last_blank) - status=STATUS_TRK_LIST_HEADER; - else - status=STATUS_RTE_PT_LIST_HEADER; - } - else - { - parsed_vars=sscanf(line_buf, "Route\t%[^\t]\t%[^\t]\t%[^\t]\t%[^\t]", - &f_Name, &f_Length, &f_Course, &Waypoints); - if (parsed_vars<1) - { - printf("Error parsing line %d as a route. Need at least 1 var, only got %d\n", - loop_count+1, parsed_vars); - printf("Problem line is: %s\n", line_buf); - } - else - { - dat->rte_list=(struct gpxrte **)xrealloc(dat->rte_list, (dat->rte_list_count+1)*sizeof(struct gpxrte *)); - dat->rte_list[dat->rte_list_count]=gpxrte_new(); - dat->rte_list[dat->rte_list_count]->name = xmalloc(strlen(f_Name)+1); - str2ascii(f_Name); - strcpy(dat->rte_list[dat->rte_list_count]->name, f_Name); - dat->rte_list_count++; - } - } - break; - - case STATUS_RTE_PT_LIST_HEADER: - if (this_blank) - status=STATUS_RTE_PT_LIST_BODY; - break; - - case STATUS_RTE_PT_LIST_BODY: - if (this_blank) - //loop back to another new route - status=STATUS_RTE_ITEM; - else - { - parsed_vars=sscanf(line_buf, "Route Waypoint\t%[^\t]\t%[^\t]\t%[^\t]\t%[^\t]", - &f_WaypointName, &f_Distance, &f_LegLength, &f_Course); - if (parsed_vars<1) - { - printf("Error parsing line %d as a routepoint. Need at least 1 var, only got %d\n", - loop_count+1, parsed_vars); - printf("Problem line is: %s\n", line_buf); - } - else - { - matching_wpt=find_matching_wpt(dat, f_WaypointName); - if (matching_wpt == NULL) - { - printf("Ignoring routepoint %s because I cant match it to any waypoints\n", - f_WaypointName); - } - else - { - thisrte = dat->rte_list[dat->rte_list_count-1]; - thisrte->rtept_list=(struct gpxpt **)xrealloc(thisrte->rtept_list, - (thisrte->rtept_list_count+1)*sizeof(struct gpxpt *)); - this_gpxpt = thisrte->rtept_list[thisrte->rtept_list_count] = gpxpt_copy(matching_wpt); - thisrte->rtept_list_count++; - } - } - } - break; - - case STATUS_TRK_LIST_HEADER: - // check type & set proper status - if (this_blank && !last_blank) - status=STATUS_TRK_ITEM; - break; - - case STATUS_TRK_ITEM: - if (this_blank) - { - if (last_blank) - status=STATUS_EOF; - else - status=STATUS_TRK_PT_LIST_HEADER; - } - else - { - parsed_vars=sscanf(line_buf, "Track\t%[^\t]\t%[^\t]\t%[^\t]\t%[^\t]\t%[^\t]", - &f_Name, &f_StartTime, &f_ElapsedTime, &f_Length, &f_AverageSpeed); - if (parsed_vars<1) - { - printf("Error parsing line %d as a Track. Need at least 1 var, only got %d\n", - loop_count+1, parsed_vars); - printf("Problem line is: %s\n", line_buf); - } - else - { - dat->trk_list=(struct gpxtrk **)xrealloc(dat->trk_list, - (dat->trk_list_count+1)*sizeof(struct gpxtrk *)); - dat->trk_list[dat->trk_list_count]=gpxtrk_new(); - //dat->trk_list[dat->trk_list_count]->name = (char*)malloc(strlen(f_Name)+1); - //strcpy(dat->trk_list[dat->trk_list_count]->name, f_Name); - dat->trk_list_count++; - } - } - break; - - case STATUS_TRK_PT_LIST_HEADER: - if (this_blank) - status=STATUS_TRK_PT_LIST_BODY; - break; - - case STATUS_TRK_PT_LIST_BODY: - if (this_blank) - // loop back for another new track - status=STATUS_TRK_ITEM; - else - { - parsed_vars=sscanf(line_buf, "Trackpoint\t%c%lf %c%lf\t%[^\t]\t%[^\t]\t%[^\t]\t%[^\t]\t%[^\t]\t%[^\t]", - &f_lat_dir, &f_lat, &f_lon_dir, &f_lon, &f_DateTime, &f_Altitude, - &f_Depth, &f_LegLength, &f_LegTime, &f_LegSpeed, &f_LegCourse); - if (parsed_vars<4) - { - printf("Error parsing line %d as a track-point. Need at least 4 vars, only got %d\n", - loop_count+1, parsed_vars); - printf("Problem line is: %s\n", line_buf); - } - else - { - struct gpxtrk * thistrk = dat->trk_list[dat->trk_list_count-1]; - thistrk->trkpt_list=(struct gpxpt **)xrealloc(thistrk->trkpt_list, - (thistrk->trkpt_list_count+1)*sizeof(struct gpxpt *)); - thistrk->trkpt_list[thistrk->trkpt_list_count]=gpxpt_new(); - - if (f_lat_dir=='S') - f_lat=-f_lat; - else if(f_lat_dir!='N') - printf("Error parsing line %d as a waypoint. '%c' when expecting 'N' or 'S' for latitdue.\n", f_lat_dir); - - if (f_lon_dir=='W') - f_lon=-f_lon; - else if(f_lon_dir!='E') - printf("Error parsing line %d as a waypoint. '%c' when expecting 'E' or 'W' for longitude.\n", f_lat_dir); - - thistrk->trkpt_list[thistrk->trkpt_list_count]->lat=f_lat; - thistrk->trkpt_list[thistrk->trkpt_list_count]->lon=f_lon; - thistrk->trkpt_list_count++; - } - } - break; - - default: - {; - } - } - - last_status=status; - last_blank=this_blank; - - loop_count++; - if (loop_count>MAX_LINES) - { - printf("Read %d input lines, which seems rather high\n", loop_count); - break; - } - - } - - if(opts.verbose_flag>4) - print_gpx_data(dat); - - return dat; -} diff --git a/st2gpx/src/st2gpx license.txt b/st2gpx/src/st2gpx license.txt deleted file mode 100644 index 5068e4342..000000000 --- a/st2gpx/src/st2gpx license.txt +++ /dev/null @@ -1,23 +0,0 @@ -st2gpx - -Extract data from MS Streets & Trips .est and Autoroute .axe files in GPX format. - -Copyright (C) 2003 James Sherring, james_sherring@yahoo.com - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111 USA - - -st2gpx depends on istorage & istorage-make from Pabs (pabs3@zip.to) -and James Clark's Expat xml parser from http://www.libexpat.org/. diff --git a/st2gpx/src/st2gpx.c b/st2gpx/src/st2gpx.c deleted file mode 100644 index cd40d9ea5..000000000 --- a/st2gpx/src/st2gpx.c +++ /dev/null @@ -1,675 +0,0 @@ -/* - st2gpx.c - - Extract data from MS Streets & Trips .est, Autoroute .axe - and Mapoint .ptm files in GPX format. - - Copyright (C) 2003 James Sherring, james_sherring@yahoo.com - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111 USA - - - This app depends on istorage & istorage-make from Pabs (pabs3@zip.to) - and James Clark's Expat xml parser from http://www.libexpat.org/. - -*/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -// #include -#include "getopt.h" -#include "gpx.h" -#include "st2gpx.h" -#include "annotations.h" -#include "journey.h" -#include "properties.h" -#include "contents.h" -#include "ppinutil.h" -#include "pushpins.h" - -struct st2gpx_options opts; - -void * xmalloc(size_t size) -{ - void *obj; - if (size<0) - { - fprintf(stderr, "**** Error: trying to malloc %d bytes ****/n"); - debug_pause(); - exit(-1); - } - obj = malloc(size); - if (!obj) - { - fprintf(stderr, "Unable to allocate %d bytes of memory.\n", size); - debug_pause(); - exit(-1); - } - - return obj; -} - -void * xrealloc(void* ptr, size_t size) -{ - void *obj; - if (size<0) - { - fprintf(stderr, "**** Error: trying to malloc %d bytes ****/n"); - debug_pause(); - exit(-1); - } - - obj = realloc(ptr, size); - if (!obj) - { - fprintf(stderr, "Unable to (re)allocate %d bytes of memory.\n", size); - debug_pause(); - exit(-1); - } - - return obj; -} - -char * str2ascii(char* str) -{ - int i; - int len; - unsigned char * ustr = (unsigned char*)str; - - if(str==NULL) - return str; - - len=strlen(str); - for(i=0; i127) || (ustr[i]==0x1c) ) - { - printf("Converting non-ascii char %c to space.\n", ustr[i]); - str[i]=' '; - } - return str; -} - -char * strappend(char* str1, char* str2) -// create a new string -{ - int len1; - int len2; - char* nw; - - if (str1==NULL) - len1=0; - else - len1=strlen(str1); - - if (str2==NULL) - len2=0; - else - len2=strlen(str2); - - nw = (char*)xmalloc(len1 + len2 +1); - - if (str1 != NULL) - strcpy(nw, str1); - if (str2 != NULL) - strcpy(nw+len1, str2); - - //just in case len1 + len2 =0 - nw[len1 + len2]=0; - - return nw; -} - -char* buf2str(char* buf, int strlen) -// make a null-terminated string from a buf -{ - char*str=NULL; - if (strlen==0) - return NULL; - str=(char*)xmalloc(strlen+1); - memcpy(str, buf, strlen); - str[strlen]=0; - return str; -} - -char* buf2wstr(char* buf, int strlen) -// make a null-terminated wide string from a buf -// strlen is the number of characters, not len -{ - char*str=NULL; - if (strlen==0) - return NULL; - str=(char*)xmalloc(2*strlen+1); - memcpy(str, buf, 2*strlen); - str[2*strlen]=0; - str[2*strlen + 1]=0; - return str; -} - -int readbytes(FILE* file, char* buf, int bytes2read) -{ - int i; - i = fread(buf, 1, bytes2read, file); - if (i 5) - { - printf("Readbytes: Read %d bytes from file\n",bytes2read); - printbuf(buf, bytes2read); - fflush(stdout); - } - return(i); -} - -void show_usage() -{ - printf("st2gpx - Export data from MS Streets & Trips, Autoroute and Mappoint to GPX format\n\n"); - // FIXME update this line - printf("Usage: st2gpx [-hr] [-v verbose-level] [-g gpx-in-file] [-G gpx-out-file]"); - printf(" [-m mpst-in-file] [-M pcx5-out-file] [-F st-mod-file] stfile\n\n"); - printf("-h : Help (this text)\n"); - printf("-r : Export drawn-lines as routes instead of tracks\n"); - printf("-g gpx-in-file : Import data from GPX XML format gpx-in-file\n"); - printf("-G gpx-out-file : Write output to GPX XML format gpx-out-file\n"); - printf("-F st-mod-file : Write modified stfile with imported data\n"); - printf(" to (new) st-mod-file.\n"); - printf("-m mpst-in-file : Import data from Garmin MapSource text-export mpst-in-file\n"); - printf("-M pcx5-out-file : Write output to Garmin MapSource importable pcx5-out-file\n"); - printf("\n"); - printf("export hint:\t st2gpx stfile (or use drag & drop)\n"); - printf("import hint:\t st2gpx -g gpx-in-file -F st-mod-file st-template-file\n"); -// printf("\n"); - debug_pause(); - printf("Debugging options:\n"); - printf("-e : Explore data further\n"); - printf("-v [n] : Set debugging verbosity to 'n' (0-6, default 2)\n"); - printf("-u userdata-file : Process pushpins in (mdb) file userdata-file\n"); - printf("-j journey-file : Process Journey in file journey-file\n"); - printf("-a annotations-file : Process Annotations in file annotations-file\n"); - printf("-p properties-file : Analyse OLE properties-file\n"); - - debug_pause(); - exit(0); -} - -void xsystem(char* syscmd) -{ - int status; - int original_stderr; - char* tempname=NULL; - FILE* tempfile; - - if (opts.verbose_flag > 2) - printf("%s \n", syscmd); - else - { - // Throw away stderr from the system call. - // Actually, I just write it to a temp file. - original_stderr = _dup(2); // duplicate stderr - if( original_stderr == -1 ) - { - perror( "_dup( 2 ) failure" ); - exit( 1 ); - } - - tempname = tmpnam(tempname); - if( (tempname==NULL) || (( tempfile = fopen(tempname, "w") ) == NULL )) - { - puts( "Can't open tempfile for stderr\n" ); - exit( 1 ); - } - // stderr now refers to tempfile - if( -1 == _dup2( _fileno( tempfile ), 2 ) ) - { - perror( "Can't _dup2 stderr" ); - exit( 1 ); - } - } - - _flushall(); - status = system(syscmd); - - if (opts.verbose_flag < 3) - { - // restore stderr - fflush( tempfile ); - fflush( stderr ); - fclose( tempfile ); - _dup2( original_stderr, 2 ); - remove(tempname); - } - - if (status) - fprintf(stderr, "system call returned error %d\n", status); -} - -main(int argc, char** argv) -{ - int c; - - char* jour_in_file_name=NULL; - char* annot_in_file_name=NULL; - char* ppin_in_file_name=NULL; - char* gpx_in_file_name=NULL; - char* gpx_out_file_name=NULL; - char* import_file_name=NULL; - char* properties_file_name=NULL; - - char* contents_dir_name=NULL; - char source_full_path[_MAX_PATH]; - char contents_full_path[_MAX_PATH]; - - char* mpst_in_file_name=NULL; - char* pcx5_out_file_name=NULL; - - char syscmd[1000]; - char cmddrv[_MAX_DRIVE]; - char cmddir[_MAX_DIR]; - char cmdfilename[_MAX_PATH]; - char cmdext[_MAX_EXT]; - char * cmdpath=NULL; - - char file1[_MAX_PATH]; - char file2[_MAX_PATH]; - - struct pushpin_safelist* ppplist=NULL; - struct journey* jour=NULL; - struct annotations* annots=NULL; - struct gpx_data* all_gpx=NULL; - struct ole_property_set * strips_properties=NULL; - struct ole_property * prop = NULL; - struct contents * conts=NULL; - - char* temp_str=NULL; - - opts.explore_flag=0; - opts.use_gpx_route=0; - opts.verbose_flag=2; - opts.source_file_name=NULL; - opts.debug_wait_flag=0; - opts.st_version_num = 0; - opts.MapName = NULL; - - -#ifdef MEMCHK - // Call _CrtCheckMemory at every allocation and deallocation request. -// SET_CRT_DEBUG_FIELD(_CRTDBG_CHECK_ALWAYS_DF); - // Keep freed memory blocks in the heaps linked list, assign them the _FREE_BLOCK type, - // and fill them with the byte value 0xDD. - SET_CRT_DEBUG_FIELD(_CRTDBG_DELAY_FREE_MEM_DF); - // Perform automatic leak checking at program exit via a call to _CrtDumpMemoryLeaks - // and generate an error report if the application failed to free all the memory - // it allocated. - SET_CRT_DEBUG_FIELD(_CRTDBG_LEAK_CHECK_DF); -#endif - -#ifdef DEBUG_STDOUT - _CrtSetReportMode( _CRT_WARN, _CRTDBG_MODE_FILE ); - _CrtSetReportFile( _CRT_WARN, _CRTDBG_FILE_STDOUT ); - _CrtSetReportMode( _CRT_ERROR, _CRTDBG_MODE_FILE ); - _CrtSetReportFile( _CRT_ERROR, _CRTDBG_FILE_STDOUT ); - _CrtSetReportMode( _CRT_ASSERT, _CRTDBG_MODE_FILE ); - _CrtSetReportFile( _CRT_ASSERT, _CRTDBG_FILE_STDOUT ); -#endif - - // Set this to find where leaking mem was allocated - //_CrtSetBreakAlloc(209); - - while (1) - { - /* getopt_long stores the option index here. */ - int option_index = 0; - - c = getopt(argc, argv, "hu:j:a:g:G:m:M:F:p:rv::ew"); - - /* Detect the end of the options. */ - if (c == -1) - break; - - switch (c) - { - case 0: - /* If this option set a flag, do nothing else now. */ - break; - - case 'h': - show_usage(); - break; - - case 'u': - // read a UserData (pushpin) file directly - free(ppin_in_file_name); - ppin_in_file_name = (char*)xmalloc(strlen(optarg)+1); - strcpy(ppin_in_file_name, optarg); - if (opts.verbose_flag > 1) - printf("Analysing UserData (pushpin) stream in file %s\n\n", jour_in_file_name); - break; - - case 'j': - // read a Journey file directly - free(jour_in_file_name); - jour_in_file_name = (char*)xmalloc(strlen(optarg)+1); - strcpy(jour_in_file_name, optarg); - if (opts.verbose_flag > 1) - printf("Analysing Journey stream in file %s\n\n", jour_in_file_name); - break; - - case 'a': - // read an annotation file directly - annot_in_file_name = (char*)xmalloc(strlen(optarg)+1); - strcpy(annot_in_file_name, optarg); - if (opts.verbose_flag > 1) - printf("Analysing Annotation stream in file %s\n\n", annot_in_file_name); - break; - - case 'g': - gpx_in_file_name = (char*)xmalloc(strlen(optarg)+1); - strcpy(gpx_in_file_name, optarg); - if (opts.verbose_flag > 1) - printf("Reading GPX from file %s\n\n", gpx_in_file_name); - break; - - case 'G': - gpx_out_file_name = (char*)xmalloc(strlen(optarg)+1); - strcpy(gpx_out_file_name, optarg); - if (opts.verbose_flag > 1) - printf("Writing GPX output to file %s\n\n", gpx_out_file_name); - break; - - case 'm': - mpst_in_file_name = (char*)xmalloc(strlen(optarg)+1); - strcpy(mpst_in_file_name, optarg); - if (opts.verbose_flag > 1) - printf("Reading Garmin MapSource Text format from file %s\n\n", mpst_in_file_name); - break; - - case 'M': - pcx5_out_file_name = (char*)xmalloc(strlen(optarg)+1); - strcpy(pcx5_out_file_name, optarg); - if (opts.verbose_flag > 1) - printf("Writing Garmin MapSource importable pcx5 output to file %s\n\n", pcx5_out_file_name); - break; - - case 'F': - import_file_name = (char*)xmalloc(strlen(optarg)+1); - strcpy(import_file_name, optarg); - if (opts.verbose_flag > 1) - printf("Writing modified s&t file with imported gpx data to file %s\n\n", import_file_name); - break; - - case 'p': - properties_file_name = (char*)xmalloc(strlen(optarg)+1); - strcpy(properties_file_name, optarg); - if (opts.verbose_flag > 1) - printf("Analysing OLE Properties from file %s\n\n", properties_file_name); - break; - - case 'r': - opts.use_gpx_route=1; - break; - - case 'v': - if (optarg==NULL) - opts.verbose_flag=5; - else - opts.verbose_flag = atoi(optarg); - break; - - case 'e': - opts.explore_flag = 1; - break; - - case 'w': - opts.debug_wait_flag = 1; - break; - - case '?': - /* getopt_long already printed an error message. */ - show_usage(); - break; - - default: - show_usage(); - abort (); - } - } - - if (optind == argc-1) - { - opts.source_file_name = (char*)xmalloc(strlen(argv[optind])+1); - strcpy(opts.source_file_name, argv[optind]); - if (opts.verbose_flag > 1) - printf("Analysing MS Map file %s\n\n", opts.source_file_name); - if (ppin_in_file_name==NULL) - ppin_in_file_name = strappend(opts.source_file_name, ".Contents\\UserData.mdb"); - if (jour_in_file_name==NULL) - jour_in_file_name = strappend(opts.source_file_name, ".Contents\\Journey"); - if (annot_in_file_name==NULL) - annot_in_file_name = strappend(opts.source_file_name, ".Contents\\Annotations"); - if ((gpx_out_file_name==NULL) && (gpx_in_file_name==NULL)) - gpx_out_file_name = strappend(opts.source_file_name, ".gpx"); - } - else if (optind < argc-1) - { - printf("Unrecognised option %s\n", argv[optind+1]); - show_usage(); - } - else - { - if (opts.verbose_flag > 1) - printf("Not analysing any core MS Map file\n"); - } - - if (opts.source_file_name) - { - // Open the compound file using the istorage utility - // I probably should do this in a library and use streams instead of files - - // Find the path for istorage from the path in argv[0] - - _splitpath(argv[0], cmddrv, cmddir, cmdfilename, cmdext); - cmdpath = strappend(cmddrv, cmddir); - - _fullpath(source_full_path, opts.source_file_name, _MAX_PATH); - - sprintf(syscmd, "%sistorage\\istorage.exe \"%s\"", cmdpath, source_full_path); - xsystem(syscmd); - - sprintf(file1, "%s.Contents\\UserData.", opts.source_file_name); - sprintf(file2, "%s.Contents\\UserData.mdb", opts.source_file_name); - rename(file1, file2); - } - - // *************************** - // begin processing the files - // *************************** - - // Read GPX import file - if (gpx_in_file_name) - { - all_gpx = process_gpx_in_file(gpx_in_file_name); - if (all_gpx==NULL) - printf("Didn't read any usable data from %s ???\n",gpx_in_file_name); - printf("Read %d waypoints, %d routes and %d tracks from file %s\n", all_gpx->wpt_list_count, all_gpx->rte_list_count, all_gpx->trk_list_count, gpx_in_file_name); - printf("Importing this data as %d pushpins and %d lines\n", all_gpx->wpt_list_count, all_gpx->rte_list_count + all_gpx->trk_list_count); - } - - // Read Mapsource text-export file. - // Does it make any sense to try and merge with all_gpx from above? Not for now... - if (mpst_in_file_name) - { - gpx_data_delete(all_gpx); - all_gpx = read_mpstext(mpst_in_file_name); - if (all_gpx==NULL) - printf("Didn't read any usable data from %s ???\n",mpst_in_file_name); - printf("Read %d waypoints, %d routes and %d tracks from file %s\n", - all_gpx->wpt_list_count, all_gpx->rte_list_count, - all_gpx->trk_list_count, mpst_in_file_name); - printf("Importing this data as %d pushpins and %d lines\n", - all_gpx->wpt_list_count, - all_gpx->rte_list_count + all_gpx->trk_list_count); - } - - // ole properties from S&T/Autoreoute/Mappoint source file - if (opts.source_file_name) - { - strips_properties=read_ole_properties(opts.source_file_name, NULL); - prop = get_propterty(strips_properties, 0x60002); - if ((prop!=NULL) && (prop->buf != NULL) ) - { - opts.st_version_num = *(int*)(prop->buf); - printf("MS Map version in %s is %d\n", opts.source_file_name, opts.st_version_num); - } - prop = get_propterty(strips_properties, 0x10000); - if ((prop!=NULL) && (prop->buf != NULL) ) - { - opts.MapName = (WCHAR*)(prop->buf + 4); - wprintf(L"MapName is %ls\n", opts.MapName); - if(wcscmp(opts.MapName, L"USA")==0) - opts.isUSA=1; - else if(wcscmp(opts.MapName, L"EUR")!=0 ) - printf("Unknown map type, assuming EUR\n"); - } - } - - // check the contents stream - //if(opts.explore_flag) - if(opts.source_file_name) - { - temp_str = strappend(opts.source_file_name, ".Contents\\Contents"); - conts = read_contents(temp_str); - free(temp_str); - temp_str=NULL; - } - - // ole properties from any file, just for debuging - if (properties_file_name) - ole_property_set_delete(read_ole_properties(NULL,opts.source_file_name)); - - // read the data in the S&T source file - if (ppin_in_file_name) - ppplist = process_pushpin_file(ppin_in_file_name); - if (jour_in_file_name) - jour = process_journey_stream(jour_in_file_name, ppplist); - if (annot_in_file_name) - annots = process_annotations_stream(annot_in_file_name); - - // export GPX - if ( (gpx_out_file_name) && (all_gpx==NULL) ) - gpx_write_all(gpx_out_file_name, ppplist, jour, annots); - - // export Mapsource pcx5 - if (pcx5_out_file_name) - pcx5_export(pcx5_out_file_name, ppplist, jour, annots); - - // Merge the data in the S&T source file with any imported GPX/mapsource data - if ((all_gpx!=NULL) && (opts.source_file_name!=NULL)) - { - merge_gpx_annot(annots, all_gpx); - if (annots==NULL) - printf("After merging data, dont have any annotations???\n"); - printf("After merging data, there are %d annotations\n", annots->num_annotations); - write_annotations(annots, annot_in_file_name); - - sprintf(file1, "%s.Contents\\Contents", opts.source_file_name); - write_pushpins_from_gpx(ppin_in_file_name, all_gpx, conts, file1); - } - - // create the s&t/autoroute/mappoint file from the modified parts - if ((opts.source_file_name!=NULL) && (all_gpx!=NULL) && (import_file_name!=NULL)) - { - // Actually, we should allow NULL import_file_name and invent a sensible name - - sprintf(file1, "%s.Contents\\UserData.mdb", opts.source_file_name); - sprintf(file2, "%s.Contents\\UserData.", opts.source_file_name); - rename(file1, file2); - - contents_dir_name=(char*)xmalloc(strlen(opts.source_file_name)+20); - sprintf(contents_dir_name, "%s.Contents", opts.source_file_name); - - _fullpath(contents_full_path, contents_dir_name, _MAX_PATH); - - sprintf(syscmd, "%sistorage\\istorage-make.exe \"%s\"", cmdpath, contents_full_path); - xsystem(syscmd); - - remove(import_file_name); - - _splitpath(opts.source_file_name, cmddrv, cmddir, cmdfilename, cmdext); - sprintf(file1, "%s.Contents.ole", opts.source_file_name); - rename(file1, import_file_name); - } - - // Clean up the compound file directory - if (opts.source_file_name) - { - { - sprintf(syscmd, "echo y|del \"%s.Contents\" > null", opts.source_file_name); - xsystem(syscmd); - - sprintf(file1, "%s.Contents", opts.source_file_name); - _rmdir(file1); - } - } - - // free variables. Not really necessary. - annotations_delete(annots); - pushpin_safelist_delete(ppplist); - journey_delete(jour); - gpx_data_delete(all_gpx); - ole_property_set_delete(strips_properties); - contents_delete(conts); - - free(cmdpath); - free(ppin_in_file_name); - free(jour_in_file_name); - free(annot_in_file_name); - free(gpx_in_file_name); - free(gpx_out_file_name); - free(pcx5_out_file_name); - free(import_file_name); - free(opts.source_file_name); - free(contents_dir_name); - free(mpst_in_file_name); - - if (opts.verbose_flag>5) - printf("Done freeing all\n"); - - _flushall(); - -//#ifdef _DEBUG -// _CrtDumpMemoryLeaks(); -//#endif - printf("All done.\n"); - debug_pause(); -} diff --git a/st2gpx/src/st2gpx.dsw b/st2gpx/src/st2gpx.dsw deleted file mode 100644 index c71a2e211..000000000 --- a/st2gpx/src/st2gpx.dsw +++ /dev/null @@ -1,29 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "st2gpx"=.\st2gpx.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/st2gpx/src/st2gpx.h b/st2gpx/src/st2gpx.h deleted file mode 100644 index c1fb04900..000000000 --- a/st2gpx/src/st2gpx.h +++ /dev/null @@ -1,114 +0,0 @@ -/* - st2gpx.h - - Extract data from MS Streets & Trips .est, Autoroute .axe - and Mapoint .ptm files in GPX format. - - Copyright (C) 2003 James Sherring, james_sherring@yahoo.com - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111 USA - - - This app depends on istorage & istorage-make from Pabs (pabs3@zip.to) - and James Clark's Expat xml parser from http://www.libexpat.org/. - -*/ -#ifdef __cplusplus -extern "C" { -#endif - -//#define EXPLORE - -#ifdef _DEBUG -#define MEMCHK -#define DEBUG_STDOUT - -#define _CRTDBG_MAP_ALLOC -#define SET_CRT_DEBUG_FIELD(a) _CrtSetDbgFlag((a) | _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG)) -#define CLEAR_CRT_DEBUG_FIELD(a) _CrtSetDbgFlag(~(a) & _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG)) -#else -#define SET_CRT_DEBUG_FIELD(a) ((void) 0) -#define CLEAR_CRT_DEBUG_FIELD(a) ((void) 0) -#endif - -#ifndef M_PI -#define M_PI 3.14159265358979323846 -#endif - -typedef unsigned short WCHAR; - -struct st2gpx_options -{ - // 0 - only errors - // 1 also the structured data output, e.g. line point info - // 2 also record types & parameters - // 3 also detailed summary info - // 4 also detailed analysis of headers & record params - // 5 also dump buffers - // 6 lots of debug info - int verbose_flag; - int explore_flag; - // force line-type annotations to be exported as GPX routes instead of tracks - int use_gpx_route; - char* source_file_name; - // wait for enter key at certain points in the program - int debug_wait_flag; - int st_version_num; - WCHAR* MapName; - // 0 for EUR, i.e. Autoroute - // 1 for USA, i,e, Streets & Trips - unsigned char isUSA; -}; - - -// FIXME is this the correct way to forward define these? -#ifndef __cplusplus - -extern struct point; -extern struct pushpin; -extern struct annotations; -extern struct pushpin_safelist; -extern struct annot_rec ; -extern struct gpx_data; -extern struct journey; -extern struct contents; - -#endif // __cplusplus - -//st2gpx.c -extern struct st2gpx_options opts; -void * xmalloc(size_t size); -void * xrealloc(void* ptr, size_t size); -char * str2ascii(char* str); -char * strappend(char* str1, char* str2); -char * buf2str(char* buf, int strlen); -char * buf2wstr(char* buf, int strlen); -int readbytes(FILE* file, char* buf, int bytes2read); -//nannol.c -struct annotations * merge_gpx_annot(struct annotations * annots, struct gpx_data* all_gpx); -void write_annotations(struct annotations * annots, char* annot_out_file_name); -//writepcx.c -void pcx5_export(char* pcx5_out_file_name, struct pushpin_safelist * ppplist, struct journey * jour, struct annotations * pannots); -//debug.c -void debug_pause(); -void printbuf(char* buf, int len); -void debug_show_sizes(); -//st2gpx.c -struct gpx_data * read_mpstext(char* mpstxt_file_name); - -#ifdef __cplusplus -} -#endif - diff --git a/st2gpx/src/st2gpx.sln b/st2gpx/src/st2gpx.sln deleted file mode 100644 index a90954698..000000000 --- a/st2gpx/src/st2gpx.sln +++ /dev/null @@ -1,21 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 8.00 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "st2gpx", "st2gpx.vcproj", "{3D8C8F70-1814-4424-99FF-F52C7B74C77A}" - ProjectSection(ProjectDependencies) = postProject - EndProjectSection -EndProject -Global - GlobalSection(SolutionConfiguration) = preSolution - Debug = Debug - Release = Release - EndGlobalSection - GlobalSection(ProjectConfiguration) = postSolution - {3D8C8F70-1814-4424-99FF-F52C7B74C77A}.Debug.ActiveCfg = Debug|Win32 - {3D8C8F70-1814-4424-99FF-F52C7B74C77A}.Debug.Build.0 = Debug|Win32 - {3D8C8F70-1814-4424-99FF-F52C7B74C77A}.Release.ActiveCfg = Release|Win32 - {3D8C8F70-1814-4424-99FF-F52C7B74C77A}.Release.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - EndGlobalSection - GlobalSection(ExtensibilityAddIns) = postSolution - EndGlobalSection -EndGlobal diff --git a/st2gpx/src/st2gpx.vcproj b/st2gpx/src/st2gpx.vcproj deleted file mode 100644 index 1c66f978f..000000000 --- a/st2gpx/src/st2gpx.vcproj +++ /dev/null @@ -1,472 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/st2gpx/src/writegpx.c b/st2gpx/src/writegpx.c deleted file mode 100644 index 701433aaa..000000000 --- a/st2gpx/src/writegpx.c +++ /dev/null @@ -1,446 +0,0 @@ -/* - writegpx.c - - Extract data from MS Streets & Trips .est, Autoroute .axe - and Mapoint .ptm files in GPX format. - - Copyright (C) 2003 James Sherring, james_sherring@yahoo.com - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111 USA - - - This app depends on istorage & istorage-make from Pabs (pabs3@zip.to) - and James Clark's Expat xml parser from http://www.libexpat.org/. - -*/ -#include -#include -#include - -#include "st2gpx.h" -#include "gpx.h" -#include "ppinutil.h" -#include "journey.h" -#include "annotations.h" - -#define GPX_HEADER1 "\n\n" -#define GPX_THIS_PROGRAM "st2gpx from james_sherring@yahoo.com" -#define GPX_FOOTER "" - -#define GPX_WPT 0 -#define GPX_RTEPT 1 -#define GPX_TRKPT 2 -char * gpxptypelabel[3] = {"wpt", "rtept", "trkpt"}; - -// Sequential numbering of track-points -int pt_num; - -FILE* gpx_open_write_file_header(char* gpx_out_file_name) -{ - FILE* gpx_out_file=NULL; - - if (gpx_out_file_name) - { - gpx_out_file = fopen(gpx_out_file_name, "w"); - if (gpx_out_file == NULL) - { - fprintf(stderr, "Cannot open %s\n", gpx_out_file_name); - debug_pause(); - exit(1); - } - } - else - return NULL; - - if (gpx_out_file!=NULL) - { - fprintf(gpx_out_file, GPX_HEADER1); - fprintf(gpx_out_file, GPX_HEADER2); - if (opts.source_file_name) - fprintf(gpx_out_file, "\tThis file was created from %s by %s\n", - opts.source_file_name, GPX_THIS_PROGRAM); - // Some more tags we should add here - // Descriptive name of the GPX file - // Description of the GPX file - // Name of the file's creator - // \n\t\n"); - - break; - - case ANNOT_TYPE_OVAL: - case ANNOT_TYPE_CIRCLE: - - if (annot_version==3) - { - data_os=ANNOT_RECOS_TEXT; - // FIXME get this from buf - c_shape_points=61; - point_os = ANNOT_RECOS_OVAL_POINTOS; - } - else if (annot_version==4) - { - data_os=ANNOT_RECOS_TEXT + 4; - point_os = ANNOT_RECOS_OVAL_POINTOS + 4; - c_shape_points=33; - } - else - { - printf("Unexpected annotation version %d\n", annot_version); - return; - } - - //otail = (struct f_annotation_oval_tail *)(rec->buf + data_os); - - // ************ - // trk header - // ************ - - fprintf(gpx_out_file, "\t\n"); - - fprintf(gpx_out_file, "\t\t"); - if (rec->text==NULL) - fprintf(gpx_out_file, "TK%04d\n", rec->annot_num); - else - fprintf(gpx_out_file, rec->text); - fprintf(gpx_out_file, "\n"); - - fprintf(gpx_out_file, "\t\tExtracted from Annotation %d (%s)\n", - rec->annot_num, annot_type_name[rec->type]); - fprintf(gpx_out_file, "\t\t\n"); - - // ************ - // trk points - // ************ - - for (p=0; p < c_shape_points; p++, pt_num++) - { - pt=gpx_get_point(rec->buf + point_os + 12*p); - // I wanted to keep pt names less that 6 chars, - // but there can be large polylines e.g with more than 30,000 pts - if(pt_num>9999999) - { - printf("Too many points\n"); - exit(0); - } - pt->name=(char*)xmalloc(10); - if(pt==NULL) - { - printf("got null pt #%p in annotation %d, skipping more points in this annotation\n", - p, rec->annot_num); - break; - } - if(opts.use_gpx_route) - sprintf(pt->name, "rp%04d", pt_num); - else - // we need to include a name for trackpoints - // for them to be recognised by easygps. - sprintf(pt->name, "tp%04d", pt_num); - gpx_write_point(gpx_out_file, pt, pt_type); - if(p==0) - first_point = gpxpt_copy(pt); - gpxpt_delete(pt); - } - //close the loop - gpx_write_point(gpx_out_file, first_point, pt_type); - gpxpt_delete(first_point); - - // ************* - // trk trailer - // ************* - - fprintf(gpx_out_file, "\t\t\n\t\n"); - - break; - case ANNOT_TYPE_TEXT: - default: - break; - } -} - -void gpx_write_annotations(FILE* gpx_out_file, struct annotations * annots) -{ - int i; - - if(annots->num_annotations == 0) - return; - - if(opts.use_gpx_route) - printf("writing gpx routes for %d annotations\n", annots->num_annotations); - else - printf("writing gpx tracks for %d annotations\n", annots->num_annotations); - - if ( (gpx_out_file!=NULL) && (annots!=NULL) ) - for (i=0; i < annots->num_annotations; i++) - { - gpx_write_annot_rec(gpx_out_file, annots->annot_list[i], annots->version); - } -} - -void gpx_write_all(char* gpx_out_file_name, - struct pushpin_safelist *ppplist, - struct journey * jour, - struct annotations * annots) -{ - FILE* gpx_out_file; - if ( (ppplist==NULL) && (jour==NULL) && (annots==NULL) ) - return; - gpx_out_file = gpx_open_write_file_header(gpx_out_file_name); - pt_num=0; - gpx_write_pushpinlist(gpx_out_file, ppplist); - gpx_write_journey(gpx_out_file, jour); - gpx_write_annotations(gpx_out_file, annots); - gpx_write_file_trailer(gpx_out_file); -} - diff --git a/st2gpx/src/writepcx.c b/st2gpx/src/writepcx.c deleted file mode 100644 index 4c18d8246..000000000 --- a/st2gpx/src/writepcx.c +++ /dev/null @@ -1,473 +0,0 @@ -/* - writepcx.c - - Extract data from MS Streets & Trips .est, Autoroute .axe - and Mapoint .ptm files in GPX format. - - Copyright (C) 2003 James Sherring, james_sherring@yahoo.com - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111 USA - - - This app depends on istorage & istorage-make from Pabs (pabs3@zip.to) - and James Clark's Expat xml parser from http://www.libexpat.org/. - -*/ -#include -#include -#include -#include -#include - -#include "gpx.h" -#include "st2gpx.h" -#include "ppinutil.h" -#include "journey.h" -#include "annotations.h" - -#define GAR_WPT_HEADER "H IDNT LATITUDE LONGITUDE DATE TIME ALT DESCRIPTION PROXIMITY SYMBOL ;waypts\n" -#define GAR_RTE_HEADER_JOUR "R 01 Streets&Trips Journey\n" -#define GAR_TRK_HEADER "H LATITUDE LONGITUDE DATE TIME ALT ;track\n" - -#define GAR_WPT 1 -#define GAR_RTE 2 -#define GAR_TRK 3 - -// maximum number of susbstitutions to try get a unique IDENT -#define MAX_IDENT_SUB 10000 - -char* strpad(char* str, int padlen) -// Right-pad a string with spaces so that strlen(str)=padlen, -// or just truncate str if it is longer that padlen. -// str must have at least padlen+1 bytes allocated. -{ - int i; - str[padlen]=0; - for(i=strlen(str); i96) && (c<123)) - c= str[i]=c-32; - //convert all non-conforming characters to spaces - if( !( ((c>47) && (c<59)) || ((c>64) && (c<91)) || (c==45) )) - { - str[i]=' '; - } - } - str[6]=0; -} - -void comp_mk_uniq_idents(char* ident_array, int ident_to_mk_uniq, int count_idents) -// compare ident_to_mk_uniq-th ident to all preceding idents, -// and make ident_to_mk_uniq-th ident -{ - int j; - int k; - int m; - char test_ident[7]; - char uniq_part[7]; - int duplicate_flag; - - // compare this ident with all the idents verified as unique - for(j=0; jcount_rtepts == 0) - return; - } - else - count_ppins=ppplist->num_pushpins; - - ident_array=(char*)xmalloc(7*(count_ppins + jour->count_rtepts)); - - // copy ppin names before we start mangling them - for (i=0; i< (count_ppins); i++) - { - if(ppplist->pushpin_list[i]->UdName) - memcpy(ident_array +7*i, ppplist->pushpin_list[i]->UdName, 6); - else - ident_array[7*i]=0; - //printf("pushpin_list[%d]->UdName:%s\n", i, ppplist->pushpin_list[i]->UdName); - //printf("ident_array[7*%d]:%s\n", i, ident_array+7*i); - garmin_ident_crush(ident_array+7*i); - //printf("Made Ident:%s\n",ident_array+7*i ); - } - - // copy rtept names before we start mangling them - for (i=0; i< (jour->count_rtepts); i++) - { - memcpy(ident_array + 7*(count_ppins) +7*i, - jour->rtept_list[i].text1, - 6); - garmin_ident_crush(ident_array + 7*(count_ppins) + 7*i); - } - - // compare all fresh ppin idents - for(i=0; i<(count_ppins); i++) - { - // Verify ident_array[7*i] is unique. - // Create a unique ident if neccesary. - // Only check against list of already-verified unique - comp_mk_uniq_idents(ident_array, i, count_ppins + jour->count_rtepts); - - strncpy(ppplist->pushpin_list[i]->garmin_ident, ident_array+7*i, 7); - } - - // compare jour rtept idents to ppin idents + other jour rtept idents - for(i=0; icount_rtepts; i++) - { - if (jour->rtept_list[i].pushpin != NULL) - { - // The rtept has a matching pushpin, so use the pushpin's garmin_ident - memcpy(jour->rtept_list[i].garmin_ident, - jour->rtept_list[i].pushpin->garmin_ident, - 7); - } - else - { - f_wpt_head = (struct f_jour_pt_head *)(jour->buf + (jour->rtept_list[i].pthead_os)); - lat=scaled2deg(f_wpt_head->scaled_lat); - lon=scaled2deg(f_wpt_head->scaled_lon); - for(j=0; jpushpin_list[j]->lat)<0.00001) - && (fabs(lon-ppplist->pushpin_list[j]->lon)<0.00001) ) - { - // The rtept has a matching pushpin, so use the pushpin's garmin_ident - memcpy(ident_array + 7*(count_ppins) +7*i, - ppplist->pushpin_list[j]->garmin_ident, - 7); - // Although the journey stream doesn't associate this pushpin with the route, - // I have decided to. Again, this is questionable - // but not likely to happen anyway. - jour->rtept_list[i].pushpin = ppplist->pushpin_list[j]; - } - else - { - // no matching wpt for this rtept, so we need to create one. - // We just create the garmin_ident in the jour-rtept here, - // later we will write a corresponding wpt to the pcx file. - comp_mk_uniq_idents(ident_array, count_ppins + i, count_ppins + jour->count_rtepts); - } - } - // set the jour-rtept garmin_ident - memcpy(jour->rtept_list[i].garmin_ident, - ident_array + 7*(count_ppins) +7*i, - 7); - } - free(ident_array); -} - -void gar_write_header(FILE* gar_out_file) -{ - fprintf(gar_out_file, "H SOFTWARE NAME & VERSION\n"); - fprintf(gar_out_file, "I PCX5 2.09 output from st2gpx by James Sherring - james_sherring@yahoo.com"); - fprintf(gar_out_file, "\n"); - fprintf(gar_out_file, "H R DATUM IDX DA DF DX DY DZ\n"); - fprintf(gar_out_file, "M G WGS 84 121 +0.000000e+00 +0.000000e+00 +0.000000e+00 +0.000000e+00 +0.000000e+00\n"); - fprintf(gar_out_file, "\n"); - fprintf(gar_out_file, "H COORDINATE SYSTEM\n"); - fprintf(gar_out_file, "U LAT LON DM\n"); - fprintf(gar_out_file, "\n"); -} - -void pcx5_write_pt(FILE* file, int pt_type, char ident[7], double lat, double lon, char timedate[19], - float alt, char desc[41], float proximity, int symbol) -{ - //char outbuf[118]; - char lat_sym; - char lon_sym; - int lat_deg; - int lon_deg; - double lat_min; - double lon_min; - - if (lat<0) - lat_sym='S'; - else - lat_sym='N'; - - if (lon<0) - lon_sym='W'; - else - lon_sym='E'; - - lat_deg=(int)floor(fabs(lat)); - lon_deg=(int)floor(fabs(lon)); - - lat_min=(fabs(lat)-lat_deg)*60; - lon_min=(fabs(lon)-lon_deg)*60; - - if ( (pt_type == GAR_WPT) || (pt_type == GAR_RTE) ) - fprintf(file, "W %6.6s ", ident); - else if (pt_type == GAR_TRK) - fprintf(file, "T "); - - fprintf(file, "%c%02.2d%08.5f %c%03.3d%08.5f", lat_sym, lat_deg, lat_min, lon_sym, lon_deg, lon_min); - fprintf(file, " %18.18s %5.5s", timedate, " "); - - if ( (pt_type == GAR_WPT) || (pt_type == GAR_RTE) ) - fprintf(file, " %40.40s %13.13s %1.3d \n", desc, " ", symbol); - else if (pt_type == GAR_TRK) - fprintf(file, "\n"); - -} - -void pcx5_write_ppin(FILE* file, struct pushpin * ppin) -{ - char timedate[19]=""; - float alt=0; - char desc[41]=""; - float proximity=0; - // FIXME this should come from the pushpin icon - int symbol=8; // or 18 - - // 18 or 19? - strpad(timedate, 18); - - // Should I create a meaningful note if there is none? - if(ppin->NoteShort) - memcpy(desc, ppin->NoteShort, 40); - else - desc[0]=0; - strpad(desc, 40); - - pcx5_write_pt(file, GAR_WPT, ppin->garmin_ident, ppin->lat, ppin->lon, timedate, - alt, desc, proximity, symbol); -} - -void pcx5_write_ppin_list(FILE* file, struct pushpin_safelist * ppplist) -{ - int i; - - if ( (file==NULL) || (ppplist==NULL)) - return; - - fprintf(file, GAR_WPT_HEADER); - for (i=0; i< (ppplist->num_pushpins); i++) - pcx5_write_ppin(file, ppplist->pushpin_list[i]); -} - -void pcx5_write_jour_pt(FILE* file, struct journey * jour, struct jour_rtept * rtept, int pt_type) -{ - char timedate[19]=""; - float alt=0; - char desc[41]; - float proximity=0; - - int symbol=8; // or 18 - struct f_jour_pt_head * f_wpt_head; - -// if(pt_type==GAR_WPT) -// { - f_wpt_head = (struct f_jour_pt_head *)(jour->buf + (rtept->pthead_os)); - - strpad(timedate, 18); - - memcpy(desc, rtept->text1,39); - strpad(desc, 40); - - pcx5_write_pt(file, - pt_type, - rtept->garmin_ident, - scaled2deg(f_wpt_head->scaled_lat), - scaled2deg(f_wpt_head->scaled_lon), - timedate, - alt, - desc, - proximity, - symbol); - -// } -// else if(pt_type==GAR_RTE) -// { -// // this is easier that calling pcx5_write_pt -// fprintf(file, "W %6.6s \n", rtept->garmin_ident); -// } -} - -void pcx5_write_journey(FILE* file, struct journey * jour, struct pushpin_safelist * ppplist) -{ - int i; - - if( (jour==NULL) || ((jour->count_rtepts) < 1) ) - return; - - // write jour rte-pts w/o ppin as wpts -// for(i=0; i< jour->count_rtepts; i++) -// if(jour->rtept_list[i].pushpin == NULL) -// pcx5_write_jour_pt(file, jour, jour->rtept_list + i, GAR_WPT); - - fprintf(file, "\n"); - fprintf(file, GAR_RTE_HEADER_JOUR); - fprintf(file, "\n"); - fprintf(file, GAR_WPT_HEADER); - - for(i=0; i< jour->count_rtepts; i++) - if(jour->rtept_list[i].pushpin) - pcx5_write_ppin(file, jour->rtept_list[i].pushpin); - else - pcx5_write_jour_pt(file, jour, jour->rtept_list+i, GAR_RTE); -} - -void pcx5_write_annot_line(FILE* file, struct annot_rec * pannot) -{ - int p; - char timedate[19]=""; - float alt=0; - struct gpxpt * pt; - - if (pannot==NULL) - return; - - fprintf(file, "\n"); - fprintf(file, GAR_TRK_HEADER); - - // fixme - 18/19 - strpad(timedate, 18); - - for(p=0; pline_points; p++) - { - pt=gpx_get_point(pannot->buf + pannot->line_offset + 12*p); - if (pt != NULL) - pcx5_write_pt(file, GAR_TRK, "", pt->lat, pt->lon, timedate, - alt, "", 0, 0); - else - { - printf("Null gpx_pt #%p from annotation %d, skipping more points in this annotation\n", - pannot->annot_num); - break; - } - gpxpt_delete(pt); - } -} - -void pcx5_write_annots(FILE* file, struct annotations * pannots) -{ - int i; - if (pannots==NULL) - return; - - for(i=0; i < pannots->num_annotations; i++) - if ( (pannots->annot_list[i]->type) == ANNOT_TYPE_LINE) - pcx5_write_annot_line(file, pannots->annot_list[i]); - -} - -void pcx5_export(char* pcx5_out_file_name, struct pushpin_safelist * ppplist, struct journey * jour, struct annotations * pannots) -{ - FILE* pcx5_out_file=NULL; - struct pushpin_safelist * new_ppplist=NULL; - - if ( (ppplist==NULL) && (jour==NULL) && (pannots==NULL) ) - return; - - // Because Garmin can only accept a nasty 6 char alphanumeric unique ID - make_uniq_idents(ppplist, jour); - - if (pcx5_out_file_name) - { - pcx5_out_file = fopen(pcx5_out_file_name, "w"); - if (pcx5_out_file == NULL) - { - fprintf(stderr, "Cannot open %s\n", pcx5_out_file_name); - debug_pause(); - exit(1); - } - } - else - return; - - gar_write_header(pcx5_out_file); - pcx5_write_ppin_list(pcx5_out_file, ppplist); - pcx5_write_journey(pcx5_out_file, jour, ppplist); - pcx5_write_annots(pcx5_out_file, pannots); -}; -- 2.30.2